w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
WPF Combobox DefaultValue (Please Select)

Add the value "Please select" to your EnumCollection

Set the default value in the combobox stylesetter

<Style x:Key="ComboStyle" TargetType="{x:Type ComboBox}">
    <Setter Property="SelectedIndex" Value="0"/>
</Style>

XAML:

<ComboBox HorizontalAlignment="Left" 
              Margin="139,299,0,0" 
              Style="{StaticResource ComboStyle}"
              VerticalAlignment="Top" 
              ItemsSource="{Binding Source={StaticResource ComboBox}}"
              Width="78"/> 




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.