Below I store specific OS screen data in static vars located in the Xamarin Forms App class
They all work in my testing.
(copy / paste from my github page - https://github.com/mattregul/Xamarin_Screensize )
Note. In all Windows examples, screensize is the namespace of the root projects
// You decided which is best for you... // Do you want Size of the App View // or // Do you want the Display resolution // ###################################### // Size of App view screensize.App.DisplayScreenHeight = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Height; screensize.App.DisplayScreenWidth = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width; // Size of screen resolution //screensize.App.DisplayScreenWidth = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().ScreenHeightInRawPixels; //screensize.App.DisplayScreenHeight = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().ScreenWidthInRawPixels; // Pixels per View Pixel // - https://msdn.microsoft.com/en-us/windows/uwp/layout/design-and-ui-intro
// Size of App view screensize.App.DisplayScreenHeight = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Height; screensize.App.DisplayScreenWidth = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width; // Pixels per View Pixel // - https://msdn.microsoft.com/en-us/windows/uwp/layout/design-and-ui-intro
namespace screensize { public class App : Application { public static double DisplayScreenWidth = 0f; public static double DisplayScreenHeight = 0f; public static double DisplayScaleFactor = 0f; public App() { string ScreenDetails = Device.OS.ToString() + " Device Screen Size:\n" + $"Width: {DisplayScreenWidth}\n" + $"Height: {DisplayScreenHeight}\n" + $"Scale Factor: {DisplayScaleFactor}";
Additional Pros:
jasonCodesAway made a nice Xamarin plugin for determining screen size
source share