Cross Thread Exception in PropertyChangedEvent in WPF
- by Ashish Ashu
I have a ListView that is binded to my custom collection.
At run time , I am updating the certain properties of my entity in my custom collection in my ViewModel. At the same time , I am also doing the custom sorting in the listview.
The custom sorting is applicable when I click on the any column header of the listview.
For example, I am updating the current datetime on my entity on every 5 seconds and simulaneously , I am applying custom sorting based on DateTime.
(The Listview is third party control).
Hence I am doing two operations on my custom collection at the same time.
Should I pass the dispatcher of my control in the view model and call any methods ( which updates any entity in my custom collection ) through UI dispatcher ?