ComboBox with No Null Values
The following article will show you how to prevent item deselection when the ComboBox selection mode is single and there is initially selected item.
Here are the steps needed to achieve the functionality describe above.
To prevent item deselection we will need to set IsClearButtonvisible
to False
and SelectionMode
to Single
Here is the ComboBox definition in XAML
the business model used:
Mainly inside the ViewModel you will need to declare a property and bind it to the ComboBox SelectedItem
property, then set a value for this property in the ViewModel's contructor:
Example for ComboBox No Null Value can be found in the ComboBox/How To section from the SDK Browser Application.