Xamarin.Forms.Device.BeginInvokeOnMainThread Method
Invokes an Action on the device main (UI) thread.

Syntax

public static void BeginInvokeOnMainThread (Action action)

Parameters

action
The Action to invoke

Remarks

This example show how to set the Text of Label on the main thread, e.g. in response to an async event.

C# Example

Device.BeginInvokeOnMainThread (() => {
  label.Text = "Async operation completed";
});
          

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0