Further to this post, I am attempting to run an IMultiValueConverter (applied to a Setter on a DataCell Style) on a DataGrid that contains a lot of cells without blocking the UI.
I considered using a BackgroundWorker but this is unsuitable because the Convert function of the converter requires a return value and the UI is blocked until it gets one.
So, I tried implementing Microsoft's DoEvents method for WPF: http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcherframe.aspx
I also tried this similar but more comprehensive method: http://forums.msdn.microsoft.com/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886#app_doevents
I have attached an example project demonstrating both methods, but neither are working. When the Dispatcher.PushFrame() method is called, an exception is thrown: "Cannot perform this operation while dispatcher processing is suspended."
Is there any way of making this work, or perhaps another method of getting the converter to run in the background or without blocking the UI while it does its work for all cells in the grid?
For the example project, I am also encountering another error that wasn't occurring in my full application, but it seems to be related to an Xceed licensing issue - SecurityException.
Any help with this would be greatly appreciated.
Associate, .NET Development
Morgan Stanley, UK