Adjustify minimium width and height to all devices

Dani_S 2,846 Reputation points


How i adjustify minimium width and height to all devices in net 7 ,window platform?


A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,960 questions
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 36,871 Reputation points Microsoft Vendor


    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()
        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.
            // 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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful