I have a xaml file with xamdatagrid that receives through the following line the data.
DispatcherPriority.ContextIdle, new Action(() => this.FeedData.Add(feedDataItem)));
If I don't use the Dispatcher it shows me the following error:
"XamDataGrid does not support changes (other than INotifyPropertyChanged.PropertyChanged or ListChangedType.ItemChanged) to its DataSource from a thread different from its Dispatcher thread."
Using the Dispatcher sorted out the problem but now it takes a LOT more longer to load the data in the UI from the Model. I need to use the dispatcher since in my file I'm using the INotifyPropertyChanged once more because I'm flagging a spinner to show when the data has finished loading.
Could you please advise me on how to change or what I could use to improve the efficiency of my code.
I am looking forward to hearing from you!
Thank you for your post. I have been looking into it, but I wasn’t able to reproduce your behavior, so if this is still an issue for you, could you please send me an isolated sample project, where this is reproduced, so I can investigate it further for you.
Looking forward for your reply.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Sorry for replying so late! Thanks for asking! I did managed to sort out the problem by dispatching 10 rows at a time to the UI and the time to upload the data on the UI is significantly better(before for 5000 rows it used to take around 50s now less than 5s).
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.