Επεξεργασία

Κοινή χρήση μέσω


ComboBox.Text Property

Definition

Gets or sets the text of the currently selected item.

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

Property Value

The string of the currently selected item. The default is an empty string ("").

Examples

This example shows how the Text property can be used to set text into the TextBox before the user makes a selection.

<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>

Remarks

When the IsEditable property is true, setting this property places initial text entered in the text box. When IsEditable is false, setting this value has no effect.

Dependency Property Information

Identifier field TextProperty
Metadata properties set to true BindsTwoWayByDefault, Journal

Applies to