Dispatch to the UI thread in WPF

How to run code on the UI thread from a background thread in WPF:

System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
// Your UI code goes here.
}));