cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tagustin2020
Impactful Individual
Impactful Individual

Center Labels Dynamically

Hello everyone,

 

I'm working on a fun little raffle app for the holidays. The length of the names of the winners are going to vary so my Width property formula for the Becky Bloom label is 22*Len(Label1.Text). I think 22 characters will be enough to accommodate our longest names. I set the X property of the Becky label to lblCongratulations.X, but as you can see it is left aligning. The Alignment property of the Becky label is Center. How do I get the Becky label to center dynamically under the Congratulations label? I wasn't able to find the solution in Community posts so any help you can give me would be appreciated. Also, if there is a chance that the Congratulations label could shift around as long/short names from the flow populate the name label, can you advise how to keep everything centered under the Holiday Party Raffle label? Thank you- Teresa

 

LabelSS.png

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

HI Teresa

Why not set the width of the Becky label equal to the width of the congratulations label? So long as the alignment property of both labels are set to centre, they should both be equally centre aligned.

View solution in original post

3 REPLIES 3
timl
Super User
Super User

HI Teresa

Why not set the width of the Becky label equal to the width of the congratulations label? So long as the alignment property of both labels are set to centre, they should both be equally centre aligned.

tagustin2020
Impactful Individual
Impactful Individual

That's a great idea-thanks! The Congratulations label should be wide enough to accommodate even the longest full name of an employee. I entered the following formula into the Width property of the Becky label:

 

lblCongratulations.Width

 

Have a great day!

Teresa

timl
Super User
Super User

Glad that solved your problem - hope you have a great day too!

Helpful resources

Announcements
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.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,290)