fixed a bug of CheckComboBox

SelectedItem cannot be restored while clearing
This commit is contained in:
NaBian committed 2021-05-24 22:34:35 +08:00
1 parent 8ca0eb53e4
commit f994ec977b
1 file changed
+9 -1
@@ -116,7 +116,15 @@ namespace HandyControl.Controls
public CheckComboBox()
{
AddHandler(Controls.Tag.ClosedEvent, new RoutedEventHandler(Tags_OnClosed));
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) => SelectedItems.Clear()));
CommandBindings.Add(new CommandBinding(ControlCommands.Clear, (s, e) =>
{
SetCurrentValue(SelectedValueProperty, null);
SetCurrentValue(SelectedItemProperty, null);
SetCurrentValue(SelectedIndexProperty, -1);
SelectedItems.Clear();
}));
ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
}