When writing device specific XAML using UWP, we can create different XAML views for each device family. For example, Track.DeviceFamily-Xbox.xaml
. This page uses the same back-end as Track.xaml
but will load when using the app on Xbox.
We can also pass in a URL to the InitializeComponent()
method to load a specific xaml page.
Now I'm wondering if I can combine these methods together. In this example, I would like the load the Xbox UI when fullscreen. The following code would be the ideal way of doing it, but.. well I'm here, so it does not work :)
public Track()
{
// If the app is full screen, we can use the Xbox UI
if (App.IsFullScreen)
{
InitializeComponent(new Uri("ms-appx:///Views/Track.DeviceFamily-Xbox.xaml", UriKind.Absolute));
}
else
{
InitializeComponent();
}
// etc ...
}
Has anyone got any ideas with what I can do? Is there a way to load the Xbox specific view, or should I just create XAML view, call it TrackXbox.xaml
, and then handle loading that view when the user is full screen or running on the Xbox?