Sunday, 1 November 2009

Creating simple WPF Multi-Thread application.

This videos shows how to create simple wpf -thread application,gives an overview of how to use "Dispatcher" object in WPF.




Below extension method will allow us to update any controls in thread safe manner.

public static class ControlExtension
{
public static void UpdateControlSafe(this Control control, Action code)
{
if (!control.Dispatcher.CheckAccess())
control.Dispatcher.BeginInvoke(code);
else
code.Invoke();
}
}

No comments:

Post a Comment