I posted this in one of my other threads but wanted it to be more prominent and easier to find and also easier to hand for fellow devs.
FIX FULLSCREEN ON XBOX: for broken templates
Fix for UWP 3.8DevBranch template
You need to have:
using System;
...
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
...
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
...
using Windows.UI.Xaml.Navigation;
In your App.xaml.cs
And then just at the start of everything:
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
static string deviceFamily;
Add that field static string deviceFamily;
And add:
//API check to ensure the "RequiresPointerMode" property exists, ensuring project is running on build 14393 or later
if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Application", "RequiresPointerMode"))
{
//If running on the Xbox, disable the default on screen pointer
if (IsXbox())
{
Application.Current.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested;
}
}
Before the closing bracket of public App()
And then add:
/// <summary>
/// Detection code in Windows 10 to identify the platform it is being run on
/// This function returns true if the project is running on an XboxOne
/// </summary>
public static bool IsXbox()
{
if (deviceFamily == null)
deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
return deviceFamily == "Windows.Xbox";
}
Immediately after public App()
And then the top of OnLaunched() should look like this:
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
// By default we want to fill the entire core window.
ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
...
}
Just after that #endif ' you should see 'Frame rootFrame = Window.Current.Content as Frame;...
.
An additional thing to add:
Add this to public Game1()
_graphics.IsFullScreen = true;
And viola, that’s the full screen template fixed.
…
Also the XAML pages simply show:
xmlns:local="using:UwpGame">
All the time, this is App.xaml
And the same in GamePage.xaml, it does not appear to cause any issues and I can manually correct it but, um it might fail validation and cause page change issues? I think I noticed this work half the time that it would state the project name, so something is broken somewhere, wish I knew how to fix it but right now, VS hookups are not my scene.
EDIT
Also to note, max 17763 and min 14393 target platforms are required.
Update to this from the original post:
Windows 10 SDK 10.0.18362.0
Is the SDK you need at present.
So, I hope someone finds this useful and avoids the headache I had for days while trying to get this working only to discover the template got broken… so, I reverted to an older working project to check line by line and found the missing components.
The original post that this thread is a refresh of: