Browse Source

Merge pull request #6509 from workgroupengineering/fixes/Issue_6508

fixes(DataGrid): Issue #6508 does not re-enter the edit mode after pressing ESC
pull/6572/head
Max Katz 5 years ago
committed by GitHub
parent
commit
b4a2f37af1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/Avalonia.Controls.DataGrid/DataGrid.cs

16
src/Avalonia.Controls.DataGrid/DataGrid.cs

@ -4489,17 +4489,27 @@ namespace Avalonia.Controls
element = dataGridColumn.GenerateEditingElementInternal(dataGridCell, dataGridRow.DataContext); element = dataGridColumn.GenerateEditingElementInternal(dataGridCell, dataGridRow.DataContext);
if (element != null) if (element != null)
{ {
// Subscribe to the new element's events
element.Initialized += EditingElement_Initialized; dataGridCell.Content = element;
if (element.IsInitialized)
{
PreparingCellForEditPrivate(element as Control);
}
else
{
// Subscribe to the new element's events
element.Initialized += EditingElement_Initialized;
}
} }
} }
else else
{ {
// Generate Element and apply column style if available // Generate Element and apply column style if available
element = dataGridColumn.GenerateElementInternal(dataGridCell, dataGridRow.DataContext); element = dataGridColumn.GenerateElementInternal(dataGridCell, dataGridRow.DataContext);
dataGridCell.Content = element;
} }
dataGridCell.Content = element;
} }
private void PreparingCellForEditPrivate(Control editingElement) private void PreparingCellForEditPrivate(Control editingElement)

Loading…
Cancel
Save