Screen size not correct on Windows10

Hi everyone,
I recently upgraded to the latest build of Monogame after almost one year since the last time I used it and I’m starting a new project for Windows 10 Mobile using the Universal App Template.
I haven’t written anything consistent, and this bug occurs even in a new project.
When I start the application on the emulator or on an actual device the screen coordinates are a bit off.
Let’s say I’m using the Windows 10 Emulator 720p 1GB, the screen sizes should be 1280x720, but I have 1232x720 and a black band on top if i’m portrait or on the left if i’m in landscape.
The same things happens on others emulator and on actual devices too.
There is some kind of hack to bypass this behaviour?
Thnaks for the help

@LightAndrek - Try making this change to your App.xaml.cs:

Yes, adding that piece of code solved the problem. But now the status bar doesn’t automatically hide so I added this piece of code just under

        ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
        
        if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
        {
            var statusBar = StatusBar.GetForCurrentView();
            statusBar.HideAsync();
        }

Sorry for the double post but i’ve found something odd. The drawing Surface seems to be the entire screen now, but if I call the Viewport.Width it says 1192 so I still don’t know the correct screen size. In a 800x480 environment i lose some width pixels too.

Thanks… good to know. This will be in the new default template moving forward.

Not sure why… it looks like we need to debug this more closely and figure out where than 1192 is coming from.

Check this out:

Your symptoms don’t sound exactly the same as mine, but could just be a different setup. My window was shrunk, so I had to use the suggested code to get the DisplayInformation and scale the code I used for the “actual” resolution size. I added the following 3 lines of code to achieve what I needed:

#if WINDOWS_UAP
            DisplayInformation d = DisplayInformation.GetForCurrentView();
            this.actualHeight = (int)(this.actualHeight * d.RawPixelsPerViewPixel);
            this.actualWidth = (int)(this.actualWidth * d.RawPixelsPerViewPixel);
#endif

Seems to have worked on the 4 inch, 5 inch 720p, 6 inch 1080p emulators, plus on local deployment to my 1440p screen.