CoreDispatcher dispatcher = Window.Current.CoreWindow.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { MyTextBlock.Text = "Hello, world!"; });
private async void Button_Click(object sender, RoutedEventArgs e) { // Do some long-running task on a background thread var result = await Task.Run(() => { Thread.Sleep(5000); return "Task complete!"; }); // Update UI on the UI thread await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { MyTextBlock.Text = result; }); }Package library: Windows.Winmd, Windows.Foundation.UniversalApiContract.