I have an ObservableCollection bound to a WPFToolkit DataGrid in an MVVM pattern. Every 30 seconds I have a background thread that is querying a service for some data. When it returns, it marshals it to the UI thread and updates the ObservableCollection by first calling Clear() on the collection and then calling Add() for each item. When this happens, the data is updated properly to the screen, however, the datagrid flickers. How can I prevent this from happening?
I have an ObservableCollection bound to a WPFToolkit DataGrid in an MVVM pattern. Every
Share
It appears you’re simply replacing all of your data if you’re clearing then adding each item one at a time. Instead of re-using your ObservableCollection, can you simply set your data grid’s itemssource to a new ObservableCollection with your new items?