Browse Source

fixes(Datagrid): Avoid using Threading.Dispatcher.UIThread.Post(

pull/6509/head
Giuseppe Lippolis 5 years ago
parent
commit
7a8650ae06
  1. 11
      src/Avalonia.Controls.DataGrid/DataGrid.cs

11
src/Avalonia.Controls.DataGrid/DataGrid.cs

@ -4489,13 +4489,11 @@ namespace Avalonia.Controls
element = dataGridColumn.GenerateEditingElementInternal(dataGridCell, dataGridRow.DataContext); element = dataGridColumn.GenerateEditingElementInternal(dataGridCell, dataGridRow.DataContext);
if (element != null) if (element != null)
{ {
dataGridCell.Content = element;
if (element.IsInitialized) if (element.IsInitialized)
{ {
Threading.Dispatcher.UIThread.Post(() => PreparingCellForEditPrivate(element as Control);
{
PreparingCellForEditPrivate(element as Control);
});
} }
else else
{ {
@ -4508,9 +4506,10 @@ namespace Avalonia.Controls
{ {
// 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