ComboBox.Text Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Item | Value |
---|---|
Identifier field | TextProperty |
Metadata properties set to true |
BindsTwoWayByDefault, Journal |