Hello,
In MAUI, you could use DeviceDisplayInfo
to get the width and height of your device.
In the following example code, determine whether the width and height of the Editor control exceed the width and height of the screen.
protected override void OnAppearing()
{
base.OnAppearing();
MainThread.BeginInvokeOnMainThread(async () => await DelayedShowWidth());
}
private async Task DelayedShowWidth()
{
await Task.Delay(500);
if (testEditor.Width >= DeviceDisplay.MainDisplayInfo.Width
|| testEditor.Height >= DeviceDisplay.MainDisplayInfo.Height)
{
Console.WriteLine("out of screen");
// do something.
}
else
{
// do something.
}
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.