My model contains a large data object that I update from code-behind (currently this happens on the UI thread but I intend to do this in a worker later on). One of my windows has a viewmodel for this model and outputs this data object using an IValueConverter. The problem is that this conversion takes several seconds. Hence, I need my window to fetch this updated data asynchronously. How can this be done?
MyControl.xaml:
<UserControl.DataContext>
<local:DataViewModel x:Name="dataViewModel"/>
</UserControl.DataContext>
Then in code:
// This triggers my value converter and blocks the UI for several seconds!
dataViewModel.HeavyObject = data;
Where should the multi-threading code go? Should it be part of the viewmodel or my value converter?
look at
IsAsync="True"for your binding and also checkPriorityBinding.here you find more about PriorityBinding