This question is locked. New answers and comments are not allowed.
I have a combobox, shown below. The MyItems collection has a series of states with verbose display names like "State of Alaska", "State of Alabama", etc. I want the selected value -- bound to MyModel.ItemId -- to NEVER be null.
When the view is loaded, the Id starts out as not-null (defaulted by server long before), e.g. "Territory of Puerto Rico". When I focus the box, the dropdown opens with "Territory of Puerto Rico" selected. I can start backspacing just fine. But when I backspace all the way to blank, it's updating my SelectedValue with NULL.
How can I make the RadComboBox to require one of the items to be selected and NOT update the binding with NULL?
<
telerik:RadComboBox
x:Name
=
"MyComboBox"
IsReadOnly
=
"True"
IsEditable
=
"True"
CanAutocompleteSelectItems
=
"False"
IsFilteringEnabled
=
"True"
TextSearchMode
=
"Contains"
StaysOpenOnEdit
=
"True"
OpenDropDownOnFocus
=
"True"
ItemsSource
=
"{Binding MyItems}"
DisplayMemberPath
=
"DisplayName"
SelectedValuePath
=
"Id"
SelectedValue
=
"{Binding MyModel.ItemId, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=true}"
/>
When the view is loaded, the Id starts out as not-null (defaulted by server long before), e.g. "Territory of Puerto Rico". When I focus the box, the dropdown opens with "Territory of Puerto Rico" selected. I can start backspacing just fine. But when I backspace all the way to blank, it's updating my SelectedValue with NULL.
How can I make the RadComboBox to require one of the items to be selected and NOT update the binding with NULL?