ComboBox.Text Property
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
The string of the currently selected item. The default is an empty string ("").
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>
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.
Item | Value |
---|---|
Identifier field | TextProperty |
Metadata properties set to true |
BindsTwoWayByDefault, Journal |
Produto | Versões |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Comentários do .NET
O .NET é um projeto código aberto. Selecione um link para fornecer comentários: