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

プロパティ値

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 BindsTwoWayByDefault, Journal

適用対象