Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

In WPF Application, I need to prevent the combo from displaying null values during initial launch of the application, here is the code snippet on how the combo is implemented, but it should only default to the first value <<0>> instead of displaying null, How one could implement the same?

//a.xaml
XML
<ComboBox Grid.Column="1" Name ="MyComboBox" Width="80.41" IsEnabled="{Binding ElementName=MyCheckBox,Path=IsChecked, Converter={StaticResource ResourceKey=boolInverter}}" SelectedIndex="0" Margin="0,5,33.59,0" Height="21.96" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.ColumnSpan="2">
                    <ComboBoxItem>0</ComboBoxItem>
                    <ComboBoxItem>1</ComboBoxItem>
                    <ComboBoxItem>2</ComboBoxItem>



Thanks in Advance.


With Regards,
Samanth_90
Posted
Comments
Steve Maier 26-Apr-12 11:16am    
Is this WPF 3, 3.5 or 4? This code works for me on .NET 4.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900