You can request the actual screen width, height and scale factor.
(From https://github.com/mattregul/Xamarin_GetDeviceScreensize )
iOS AppDelegate.cs
[Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init();
Android MainActivity.cs
[Activity(Label = "Xamarin_GetDeviceScreensize.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle);
Xamarin Forms App.cs
public class App : Application { public static double DisplayScreenWidth; public static double DisplayScreenHeight; public static double DisplayScaleFactor; public App() { string ScreenDetails = Device.OS.ToString() + " Device Screen Size:\n" + $"Width: {DisplayScreenWidth}\n" + $"Height: {DisplayScreenHeight}\n" + $"Scale Factor: {DisplayScaleFactor}";
source share