Hi,
I am using a RadComboBox in my silverlight application. When I select "Clear Button" of combobox, the property used for SelectedValue is not becoming null, This is because, the
SelectedValue property is of non-nullable type. So, when I select clear button it return previous value of selected combobox. I have implemented the following code :
<telerik:RadComboBox ClearSelectionButtonContent="Clear"
ClearSelectionButtonVisibility="Visible"
telerik:StyleManager.Theme="{StaticResource Theme}" Grid.Row="1"
Grid.Column="2"
DisplayMemberPath="Name"
ItemsSource="{Binding ProviderList}"
SelectedValue="{Binding SelectedImmunVaccineDose.AdminByProvider, Mode=TwoWay}"
SelectedValuePath="Code" />
I am using MVVM Pattern :
private ImmunizationVaccineDose _selectedImmunVaccineDose;
public ImmunizationVaccineDose SelectedImmunVaccineDose
{
get
{ return _selectedImmunVaccineDose; }
set
{ if (_selectedImmunVaccineDose != value)
{ _selectedImmunVaccineDose = value;
RaisePropertyChanged("SelectedImmunVaccineDose");
} }
}
The type 'ImmunizationVaccineDose' is a Entity Class, which I can't modify.
SelectedItem can be used instead of SelectedValue but I don't want to create un-necessary
properties in View Model just for binding purpose since there are a lot of such RadComboBoxes
throughout my application where Clear functionality has to be working.
Is there any way to clear SelectedValue property?
Please let me know some solution by which we can achieve this. Thanks...
I am using a RadComboBox in my silverlight application. When I select "Clear Button" of combobox, the property used for SelectedValue is not becoming null, This is because, the
SelectedValue property is of non-nullable type. So, when I select clear button it return previous value of selected combobox. I have implemented the following code :
<telerik:RadComboBox ClearSelectionButtonContent="Clear"
ClearSelectionButtonVisibility="Visible"
telerik:StyleManager.Theme="{StaticResource Theme}" Grid.Row="1"
Grid.Column="2"
DisplayMemberPath="Name"
ItemsSource="{Binding ProviderList}"
SelectedValue="{Binding SelectedImmunVaccineDose.AdminByProvider, Mode=TwoWay}"
SelectedValuePath="Code" />
I am using MVVM Pattern :
private ImmunizationVaccineDose _selectedImmunVaccineDose;
public ImmunizationVaccineDose SelectedImmunVaccineDose
{
get
{ return _selectedImmunVaccineDose; }
set
{ if (_selectedImmunVaccineDose != value)
{ _selectedImmunVaccineDose = value;
RaisePropertyChanged("SelectedImmunVaccineDose");
} }
}
The type 'ImmunizationVaccineDose' is a Entity Class, which I can't modify.
SelectedItem can be used instead of SelectedValue but I don't want to create un-necessary
properties in View Model just for binding purpose since there are a lot of such RadComboBoxes
throughout my application where Clear functionality has to be working.
Is there any way to clear SelectedValue property?
Please let me know some solution by which we can achieve this. Thanks...