Maui toolkit popup window size controling

Haviv Elbsz 2,091 Reputation points
2023-08-24T14:03:14.2+00:00

Hello all. I built a toolkit popup according the Microsoft doc. and I want that the width of the popup window to fill the screen width. How I do that. I tried horizontal option fill but that's not working. Thank you very much

Developer technologies | .NET | .NET MAUI
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2023-08-25T03:19:55.98+00:00

    Hello,

    For adapting screen widths, you can use the official API provided by MAUI to achieve this requirement.

    Please refer to the code snippets and documentation below.

    public partial class TestPop : Popup
    {
          public TestPop()
          {
                InitializeComponent();
    		// layout is the name given to the control by x:Name
                layout.WidthRequest = DeviceDisplay.Current.MainDisplayInfo.Width;
    
        }
    }
    

    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.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.