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

Change Gallery Button if selected

I just do not understand.

I use a gallery with a button as an art menu to display more content on this page.

Now that I have selected a button, that button should be given a different fill color to show the user what choice he has made.

Thank you for your help

 

Unbenannt.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Many thanks for your help @eka24 


This is the solution to my problem. . . .

 

Button FILL: 

If(ThisItem.IsSelected; RGBA(116; 177; 102; 1);RGBA(66; 33; 16; 1))

 

gallerie.PNG

View solution in original post

17 REPLIES 17
eka24
Super User
Super User

At the OnSelect of the Button:
Collect(ColorButton, ThisItem.ID)


Then on the Fill of the button:
If(ThisItem.ID in ColorButton, Yellow,Blue)

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution

v-yutliu-msft
Community Support
Community Support

Hi @Robertjde ,

Do you want to change button's color when it is selected?
I've made a similar test for your reference:
I insert 5 buttons as an example. When you click the button, the button's color will change to red, or else it will be blue.

1)set button1's OnSelect:

Set(var,"button1")

set button1's Fill:

If(var="button1",Red,Blue)

 2)set button2's OnSelect:

Set(var,"button2")

 

 

set button2's Fill:

 

If(var="button2",Red,Blue)

 

3)set button3's OnSelect:

 

Set(var,"button3")

 

set button3's Fill:

 

If(var="button3",Red,Blue)

 

4)set button4's OnSelect:

 

Set(var,"button4")

 

set button4's Fill:

 

If(var="button4",Red,Blue)

 

5)set button5's OnSelect:

 

Set(var,"button5")

 

set button5's Fill:

 

If(var="button5",Red,Blue)

 

 

Then the variable's value will change based on which button you click. The button's fill will change based on the variable value.

32022.PNG

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@eka24 

the buttons remain in the color selection, as in the example yellow, but should turn blue again when I select the 2nd button

@v-yutliu-msft 

The buttons are integrated in a gallery, which is why the Onselect button 1,2,3,4,5 does not work and if I only use the IF function with button 1, all buttons are color-matched and not just the selected one.

The ID should be preferably a unique field in the Table or collection. So change the ID to one of the columns.

Collect(ColorButton, ThisItem.ID)
If your doesnt work show your formula for correction. its straight forward
 
Capture.JPG

@eka24 the colors do not change back when i choose another button

 

Fill.PNG

onselect.PNG

Gallery  viewGallery view

I think everything if fine except the Result column in the table may not be unique. Can you change the Result to Another Column

@eka24 ONLY the selected button should appear in a different color, because I change the content of my table (see arrow) via this button and the user should recognize which button he clicked

 

gallerie.PNG

Please what are the columns names in your table? Do you only have "Result" as your column name. Example do you have Name, ID or Any other column. i suggest you change the result with another ColumnName

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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