cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Waveflux
Frequent Visitor

Set the width of a control or container similar to Parent.Width, but for the children, like Max(Self.Children.Width)

I am building a canvas app.  I have several containers, each of which hold various controls.  

the tree view looks something like this

Container1

Label1

Lable2

Lable3

Label4

Container1_1

Label1_1

Label1_2

 

If I wanted to set the width Label1 to the width of Container1, I would write the formula: Parent.Width within the width attribute for Label1

 

But, what I actually want to do is set the container width based on the widest control, something like: Max(Self.Children.Width) within the width attribute for Container1

 

Is this possible?  I don't see any collections that reference Children or Controls within the formulas available.

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Waveflux ,

 

You could try this formula on Width property of container control.

Max(Label1.Width,Label2.Width, Label3.Width,……,…….)

 

Please note that the width of the child control cannot exceed the width of the container.

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

Thanks for replying.  While your method would work, it requires that I list every control individually.  I'm asking to see if there is a relative identifier for the children of a control, much like Parent is the relative identifier for the parent of a control.

If there isn't, I'll have to either use your method or set it manually.

View solution in original post

2 REPLIES 2
v-xiaochen-msft
Community Support
Community Support

Hi @Waveflux ,

 

You could try this formula on Width property of container control.

Max(Label1.Width,Label2.Width, Label3.Width,……,…….)

 

Please note that the width of the child control cannot exceed the width of the container.

 

Best Regards,

Wearsky

If my post helps, then please consider Accept it as the solution to help others. Thanks.

Thanks for replying.  While your method would work, it requires that I list every control individually.  I'm asking to see if there is a relative identifier for the children of a control, much like Parent is the relative identifier for the parent of a control.

If there isn't, I'll have to either use your method or set it manually.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,488)