.NET Maui Get screen Y and X

Viewed 1889

I cant seem to find how to get the screen size of the screen. I tried the Xamarin forms way:

mainDisplayInfo.Height;

Maui for windows doesnt work like this, anyone know how I can do this? Thanks!

2 Answers

Since Xamarin Essentials is now part of .NET MAUI as well, you should be able to get all the info you need with Microsoft.Maui.Essentials.DeviceDisplay.MainDisplayInfo and all the properties in there like: Width and Height.

More info here: https://docs.microsoft.com/xamarin/essentials/device-display all APIs should be the same except for the namespace where they live.

That function is currently sitting in:

Microsoft.Maui.Devices.DeviceDisplay.MainDisplayInfo
Related