Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Dynamic gallery width


Need my gallery width (and the X of the buttons inside it) adjusted dynamically based on the gallery item with the longest name, to avoid names be clipped like this:

Annotation 2020-03-24 210420.jpg


Annotation 2020-03-24 210655.jpg

The items are filtered dynamically so if the record with long name is not there, I'd expect:

Annotation 2020-03-24 214027.jpg

Any ideas?



Super User III
Super User III

Hi @JK2020 ,

Yes you can do it - a bit of mathematics involved. your Gallery Width


where x is the number of pixels a character takes up on average and y the number of pixels for the rest of your gallery width. You could also do the width of the label using the same principle without the y
I have tested this and it works.


Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.


Thank you, @WarrenBelz , this is what I was looking for (I think), the only problem is that now the gallery width changes depending on which gallery item I click on - was it the same in your testing? The "YourFieldName" in your formula is the label name of the gallery item, right?

@JK2020 ,

Yes it is the label name. I must admit I did not go clicking around it - just checked the formula worked.

You are right it adjusts with the selected item.

Helpful resources

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users


We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (70,004)