C# reset wpf toolkit CheckComboBox

237 views Asked by At

I have a CheckComboBox from the wpfToolkit and i want to reset it. That means that all items in the CheckComboBox are unchecked. Already tried to set the SelectedValue to an empty string. This works for the function itself, but in the UI the items are still checked.

I also work with Bindings and the MVVM pattern:

 <wpfTool:CheckComboBox IsSelectAllActive="True"  ItemsSource="{Binding Filter, UpdateSourceTrigger=PropertyChanged}" SelectedValue="{Binding SelectedFilterItem, UpdateSourceTrigger=PropertyChanged}" Width="140"/>
                   
2

There are 2 answers

0
Donkanaille On BEST ANSWER

I found a solution that worked for me. Its important to set SelectedValue and SelectedItem to null. Also set Mode=TwoWay and UpdateSourceTrigger=PropertyChanged to be sure.

1
Balazs Szekeres On

The following should work for the SelectedValue property:

SelectedValue="{x:Bind SelectedFilterItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

Then you should be able to reset it to null by changing your SelectedFilterItem property.