Thursday, 7 August 2014

DoEvents in WPF

Below is the equivalent of Doevents in WPF

public static void DoEvents()
{
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
}


If you want to do it in a WPF UserControl Library or CustomControl Library then you can do as below:

controlname.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));