Skip to content

Commit f6d3334

Browse files
authored
IsDropDownOpen=false on CancelCellEdit and CommitCellEdit (#1817) (#1824)
1 parent 6ffe8cf commit f6d3334

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

MaterialDesignThemes.Wpf/DataGridComboBoxColumn.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ private Style PickStyle(bool isEditing, bool defaultToElementStyle)
8888
return style;
8989
}
9090

91+
protected override void CancelCellEdit(FrameworkElement editingElement, object uneditedValue)
92+
{
93+
if (editingElement is ComboBox comboBox)
94+
comboBox.SetCurrentValue(ComboBox.IsDropDownOpenProperty, false);
95+
base.CancelCellEdit(editingElement, uneditedValue);
96+
}
97+
98+
protected override bool CommitCellEdit(FrameworkElement editingElement)
99+
{
100+
if (editingElement is ComboBox comboBox)
101+
comboBox.SetCurrentValue(ComboBox.IsDropDownOpenProperty, false);
102+
return base.CommitCellEdit(editingElement);
103+
}
104+
91105
/*
92106
/// <summary>
93107
/// Assigns the Binding to the desired property on the target object.

0 commit comments

Comments
 (0)