views:

28

answers:

2

Hi All

I have a real-time application which constantly updates a UI log (RichTextBox control) in the form of a ListView control. The control is updated with current application data received via events. My application was running very slow and i found it was due to the ListView log being updated, which blocks the UI thread. As you can imagine, the application appears highly unresponsive to the user.

I know it's possible to launch a WPF Window on it's own dedicated UI thread. I was wondering if it's possible to host a WPF Control on it's own UI thread so that the main UI thread updates the rest of the window without being blocked?

If this is not possible, please recommend alternatives to remedy this dilemma.

Thanks!

A: 

You haven't posted any code, but why don't you bind the ListView to an ObservableCollection? You update the collection and it raises an event to tell the UI that it's changed - it's this that will update the UI.

There's many tutorials on how to do this - one such can be found on Switch On The Code

ChrisF
A: 

RichTextBox is an expensive control to update regularly.

It is not possible to host a WPF control on it's own UI thread.

ObservableCollection will not work in my case, as i do not have direct access to the objects that i am binding - 3rd party objects.

My solution, which requires minimal changes, was to base the UI Log control on a ListView. ListView has been optimised for bulk and regular updates - thanks to VirtualisedStackPanel tag.

c0D3l0g1