Quantcast
Viewing all articles
Browse latest Browse all 18858

PostMessage vs. Dispatcher

Hello all,

in the Win32 API world I sometimes had to decouple a task by using PostMessage in the same thread.

In WPF I now faced the problem that I have bound a ComboBox's selected item to a property of my view model. In the setter of the property I want to react to the change of the selected item by filling a list.

The problem is that the ComboBox is not correctly rendered until the list is filled (only about 1-2 seconds but still looks bad). In Win32 I would have used PostMessage to decouple the task, then the ComboBox would be updated first and then the list would be filled.

I accomplished a similar behavior with DispatcherTimer but my question is more general: is there an equivalent to PostMessage for decoupling in the same thread?

Many thanks,
Nicolas


Viewing all articles
Browse latest Browse all 18858

Trending Articles