You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
MAUI.DataGrid does not internally handle thread synchronization for updates to its data source. When an item is added to the ObservableCollection from a thread different than the UI thread, the DataGrid does not automatically marshal the change back to the UI thread.
Calling MainThread.BeginInvokeOnMainThread when adding a item to the ItemSource collection solves the problem.
To Reproduce
Steps to reproduce the behavior:
Define a DataGrid with a ItemsSource associated to an ObservableCollection
Add an Item to the ObservableCollection from another thread, for example with Task.Run(() => itemList.Add(x));
A COM exception is thrown when _paginationStepper.IsEnabled is changed
Describe the bug
MAUI.DataGrid does not internally handle thread synchronization for updates to its data source. When an item is added to the ObservableCollection from a thread different than the UI thread, the DataGrid does not automatically marshal the change back to the UI thread.
Calling
MainThread.BeginInvokeOnMainThread
when adding a item to theItemSource
collection solves the problem.To Reproduce
Steps to reproduce the behavior:
ItemsSource
associated to anObservableCollection
ObservableCollection
from another thread, for example withTask.Run(() => itemList.Add(x));
_paginationStepper.IsEnabled
is changedMaui.DataGrid/Maui.DataGrid/DataGrid.xaml.cs
Line 1231 in 9b24fb1
Expected behavior
Either no exception, or explicitly state on the documentation that calling BeginInvokeOnMainThread is necessary.
The text was updated successfully, but these errors were encountered: