Skip to content

Commit 889d914

Browse files
authored
Fixing issue when DataGrid are nested (#2902)
Fixes #2852
1 parent 7ed178a commit 889d914

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

MaterialDesignThemes.Wpf/DataGridAssist.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ private static void AllowDirectEditWithoutFocus(object sender, MouseButtonEventA
244244
// If the cell is already being edited, we don't want to (re)start editing
245245
return;
246246
}
247+
//NB: Issue 2852 - Don't handle events from nested data grids
248+
var parentDataGrid = dataGridCell
249+
.GetVisualAncestry()
250+
.OfType<DataGrid>()
251+
.FirstOrDefault();
252+
if (parentDataGrid != dataGrid)
253+
{
254+
return;
255+
}
247256

248257
dataGrid.CurrentCell = new DataGridCellInfo(dataGridCell);
249258
dataGrid.BeginEdit();

0 commit comments

Comments
 (0)