[TIP] "Dispatcher.BeginInvoke()" in Xamarin.Forms

In traditional WP8 apps, when you want to update a visual element but you are not in the UI thread, you have to use the dispatcher like this:

Deployment.Current.Dispatcher.BeginInvoke( /* my custom task */);

In Xamarin.Forms, you have to use the Device's object static method:

Device.BeginInvokeOnMainThread(() =>
{
  // your code on UI thread here...
});

Comments

Popular posts from this blog

EMGU with Xamarin Forms guide [part 1]

[Xamarin Forms] Custom bottom bordered entry (iOS & Android)

Set your browser on Fire with P5.js