ComboBox.Text Property
.NET Framework 3.0
Gets or sets the text of the currently selected item.
Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
ComboBox Members
System.Windows.Controls Namespace
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
When there is no selected item and IsEditable is true, this is the text entered in the text box. When IsEditable if false, this value has no effect.
This example shows how the Text property can be used to set text into the TextBox when the control opens, before the user makes a selection.
<ComboBox Name="cb" Margin="10,10,3,3" Width="200" Height="30" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" IsEditable="true" Text="Open Combo Box" IsReadOnly="true" StaysOpenOnEdit="true" IsDropDownOpen="true"> <ComboBoxItem>Spain - Item 0</ComboBoxItem> <ComboBoxItem>France - Item 1</ComboBoxItem> <ComboBoxItem>Peru - Item 2</ComboBoxItem> <ComboBoxItem>Mexico - Item 3</ComboBoxItem> </ComboBox>
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Reference
ComboBox ClassComboBox Members
System.Windows.Controls Namespace