This is from a Microsoft WPF example. The source can be found on git as UsingDispatcher. It is included in a zip file that has a lot of examples.
It is sort of written up here. I have seen it in other places on MSDN (e.g. Threading Model).
I added the commented out line below the error. It works OK. Still, why the error?
private void ForecastButtonHandler(object sender, RoutedEventArgs e)
{
// Change the status image and start the rotation animation.
fetchButton.IsEnabled = false;
fetchButton.Content = "Contacting Server";
weatherText.Text = "";
_hideWeatherImageStoryboard.Begin(this);
// Start fetching the weather forecast asynchronously.
var fetcher = new NoArgDelegate(FetchWeatherFromServer);
fetcher.BeginInvoke(null, null);
//Dispatcher.BeginInvoke(DispatcherPriority.Normal, fetcher);
}
I get a PlatformNotSupportedException
at runtime.