Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

New container controls do not allow child controls to get parent width

(0) ShareShare
ReportReport
Posted on by

The new horizontal container control has a property 'Flexible width', which when enabled will allow the container to be responsive and scale to the size of the window. Anything within the container will need to know the width to size its controls accoringly. Parent.Width does not return a dynamic value for the width of the container. How can I access the current width of a flexible width container?

  • Re: New container controls do not allow child controls to get parent width

    Hi @Anonymous ,

     

    Could you tell me:

    Do you want the controls in the container to get the dynamic x coordinate of the container?

     

    If so ,use the formula ‘Parent.X’ can work. As the picture below:

    v-xiaochen-msft_0-1606443463499.jpeg

     

     

    If you do not want to get the X coordinate of the container, but want to get the X coordinate of the control in the container,

    I'm afraid this can't be achieved. When the control is put into the container, the X property of the control is invalid.

     

    If you have any ideas or suggestions, you can post them on the following websites:

    https://powerusers.microsoft.com/t5/Ideas/ct-p/PA_Comm_Ideas

     

    If you have other questions, please tell me your needs in more detail, and I will be happy to solve the problem for you.

     

    Best Regards,

    Wearsky

  • Re: New container controls do not allow child controls to get parent width

    Yes that does work, my mistake, what is not working is getting the X coordinates of a control in a horizontal container. 

  • Re: New container controls do not allow child controls to get parent width

    Hi @Anonymous ,

     

    I'm sorry I don't know if I understand your needs, could you tell me if my assumptions are correct?

    1. You create a horizontal container.
    2. Then you want to get the dynamic value of the container width.

     

    If so , I made a test and achieved it.

     

    1\ I create a horizontal container and insert a label into it.

    Set label’s Text property to:

    Parent.Width

     

    2\ The result is as follows:

    v-xiaochen-msft_0-1606377074841.png

     

    v-xiaochen-msft_1-1606377074842.png

     

    If my guess is wrong, please tell me your needs in more detail, and I will be happy to solve the problem for you.

    Best Regards,

    Wearsky

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard