次の方法で共有


ComboBox.Text プロパティ

定義

現在選択されている項目のテキストを取得または設定します。

public:
 property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
public string Text { get; set; }
member this.Text : string with get, set
Public Property Text As String

プロパティ値

現在選択されている項目の文字列。 既定値は空の文字列 ("") です。

この例では、 Text プロパティを使用して、ユーザーが選択を行う前にテキストを TextBox に設定する方法を示します。

<ComboBox Name="cb" Margin="10,10,3,3" Width="200" Height="30" Grid.Column="0" Grid.Row="2"         
          ItemsSource="{StaticResource myCities}" Text="My Cities"
          IsEditable="true"  IsReadOnly="true" 
          IsDropDownOpen="True" StaysOpenOnEdit="True">
</ComboBox>

注釈

IsEditableプロパティがtrueされている場合、このプロパティを設定すると、テキスト ボックスに最初のテキストが入力されます。 IsEditablefalseされている場合、この値を設定しても効果はありません。

依存関係プロパティ情報

品目 価値
識別子フィールド TextProperty
に設定されたメタデータ プロパティ true BindsTwoWayByDefaultJournal

適用対象