web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Centering object betwe...
Power Apps
Answered

Centering object between two other objects

(0) ShareShare
ReportReport
Posted on by 364

Good morning all,

 

Bit of mind boggler this.

 

I have the following little progress bar thing:

Capture.PNG

The bar between the two numbers (Stage1 and Stage2, from left to right) is currently centred using the following code:

 

x = (Stage1.X + Stage1.Width) + (Stage1.Width / 2)
width = Stage2.X - (Stage1.X + Stage1.Width) - (Stage1.Width)

 

Now this means that if I resize the control, the bar adjusts automatically, like below:

 

Capture1.PNG

 

But you can also see that the bar becomes too short to be useful/look any good. So I think I need the width of the bar to be a percentage of the gap between Stage1 and Stage2, and for the X to continue to centre it. 

 

Honestly I'm at a loss on how to do this. Is there anyone better at maths that can help here? Cheers!

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,833 Super User 2026 Season 1 on at

    Hi @EpicTriffid ,

     

    With the below you'll have a 10% / 80% / 10% ratio which you adjust by changing the fractions:

     

     

    X = (Stage1.X + Stage1.Width)+((Stage2.X - (Stage1.X + Stage1.Width)) * .1)
    Width = (Stage2.X - (Stage1.X + Stage1.Width)) * .8

     

     

    On top of that you may want to set the Visible property so the control disappears below a certain threshold (in the below example 25):

     

    Visible = Self.Width > 25

     

     

  • EpicTriffid Profile Picture
    364 on at

    Amazing! Thank you!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard