Created
May 29, 2016 13:02
-
-
Save henningms/056be884fe2e396183573ae203620b51 to your computer and use it in GitHub Desktop.
UWP: Project view to another screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if we have an external display available and ready to use | |
if (ProjectionManager.ProjectionDisplayAvailable) | |
{ | |
// Get the ID of the current window | |
int currentViewId = ApplicationView.GetForCurrentView().Id; | |
var newView = CoreApplication.CreateNewView(); | |
// Retrieve the Projection View ID to be used in StartProjectingAsync | |
ApplicationView newApplicationView = null; | |
// Set the content for the new view | |
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => | |
{ | |
newApplicationView = ApplicationView.GetForCurrentView(); | |
var rootFrame = new Frame(); | |
rootFrame.Navigate(typeof(ProjectedScreen2)); | |
Window.Current.Content = rootFrame; | |
Window.Current.Activate(); | |
}); | |
// Project our new view to the external display | |
await ProjectionManager.StartProjectingAsync(newApplicationView.Id, currentViewId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment