Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
More efficient way of Loading data in XamDataGrid by using Dispatcher
posted

Hi all,

I have a xaml file with xamdatagrid that receives through the following line the data.

UIDispatcher.Invoke(

 

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!

Kind regards,