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

Setting the Visible property from a Button

I have a gallery within my powerapp (GalleryApp) and I have a button in there which when pressed displays a drop down box.  The problem I have is that when the Button is pressed every instance of the drop box appears all the way down the gallery.  Is there a way that I can set the visible property on the drop box so that only the individual dropbox appears when the button is pressed?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Try setting the OnSelect property of the button to the following:

 

UpdateContext({varBtnPressed: false}); Select(Parent); UpdateContext({varBtnPressed:!varBtnPressed})

 

Have had a test my end with this and seems to be working, "moving" the dropdown to whichever gallery item is selected.

View solution in original post

6 REPLIES 6
Macwin
Resolver I
Resolver I

Set a variable like on the click event like this

Set(ButtonPressed; true);; UpdateContext({ButtonPressed : !ButtonPressed}

 

Set this code on the component you want to make visible false and true.

 

If(ButtonPressed = true; true; false)

 

Im using a different language. So my ";" are "," probably in your version 🙂

 

 

 

I have tried this but it is still the same.  It either shows every drop box in the gallery or hides every dropbox.  I only want it to show or hide the indvidual instance 

Anonymous
Not applicable

Hi @Station1901 

 

Set the OnSelect property of your button to:

 

Select(Parent);UpdateContext({varBtnPressed:!varBtnPressed})

 

And the visible property of your dropdown to:

 

varBtnPressed && ThisItem.IsSelected

 

This should achieve what you're looking for 🙂

Thanks for getting back to me.  This almost works, it does show & hide the dropdown box but if I click on a button further down the gallery it also shows & hides the other instances

Anonymous
Not applicable

Try setting the OnSelect property of the button to the following:

 

UpdateContext({varBtnPressed: false}); Select(Parent); UpdateContext({varBtnPressed:!varBtnPressed})

 

Have had a test my end with this and seems to be working, "moving" the dropdown to whichever gallery item is selected.

View solution in original post

Thankyou, this works exactly how I wanted it to.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,627)