cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Expand Button size from center

Hi,

I got a button to have a variable width dependent on clicking two other buttons. However, the width expands from the right side (as shown in GIF below). Is there a way to make it expand from the center (both left and right side move in and out)?

ezgif.com-video-to-gif.gif

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@nmoffatt 

Sure, set the X property of your button to the following:

(App.Width/2) - (Self.Width/2)

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

5 REPLIES 5
Super User III
Super User III

@nmoffatt 

Sure, set the X property of your button to the following:

(App.Width/2) - (Self.Width/2)

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

@RandyHayes  Worked perfect! Thanks

Helper II
Helper II

I Think I see what you are getting at. I do not know of any native way to get that done but Ive built a solution that I think does the job. 


On your "X" icon set it to:

Set(Expand,false)

 

On your "+" icon set it to

Set(Expand,true)

 

Create a button with the size that you want it to be when expanded. (This will essentially be a dummy button) Lets call it Button1

 

Set Button1's visibility to:

If(Expand=true,true,false)

So now if you click the plus button it will show up if you click the x button it will disapear. 

 

Now add another button thats the size you would like it to be shrunk and place it in the center Button1 

 

Set its visibility to:

If(Expand=true,false,true)

 

Now you should be all set.

 

Screen Shot 2020-09-30 at 1.42.12 PM.png

 

Screen Shot 2020-09-30 at 1.42.17 PM.png

 

Here is what it will look like when clicked. 

Let me know if that helps

 

Shoot just saw this was already solved

@Maxwell123 

Keep It Super Simple!!

 

1 Icon

Icon OnSelect Action: UpdateContext({lclExpand:!lclExpand})

Icon Icon property: If(lclExpand, Icon.CollapseView, Icon.ExpandView)

 

1 Button

Button Width property: If(lclExpand, 400, 200)

Button X property: (App.Width/2) - (Self.Width/2)

Expander.gif

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

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 (31,921)