ComboBox.Text 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定目前選取項目的文字。
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時,設定此屬性會將輸入的初始文字置於文字框中。 當 IsEditable 是 false時,設定此值不會產生影響。
相依財產資訊
| Item | 價值觀 |
|---|---|
| 識別碼欄位 | TextProperty |
元資料屬性設為 true |
BindsTwoWayByDefault、Journal |