Skip to content

Instantly share code, notes, and snippets.

@AddressXception
Created May 30, 2016 15:40
Show Gist options
  • Save AddressXception/028f5b7c9425eaae87fde5b17260f71c to your computer and use it in GitHub Desktop.
Save AddressXception/028f5b7c9425eaae87fde5b17260f71c to your computer and use it in GitHub Desktop.
Demonstrates how to switch views on HoloLens. The AppviewSource comes from the Holographic DirectX 11 Application Template that ships with the HoloLens emulator.
/// <summary>
/// https://msdn.microsoft.com/en-us/windows/uwp/layout/show-multiple-views
/// switch from this 2D XAML view to a IFrameworkView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void DirectX_OnClick(object sender, RoutedEventArgs e)
{
var exclusiveViewApplicationSource = new AppViewSource();
CoreApplicationView newView = CoreApplication.CreateNewView(exclusiveViewApplicationSource);
ApplicationView newAppView = null;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
newAppView = ApplicationView.GetForCurrentView();
CoreWindow.GetForCurrentThread().Activate();
});
await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment