I have a grid with 200 buttons.
When you select one button I want to change the fill color to red and then when you click on another button I want the previous button to go back to transparent and the new button to go red. Is it there any easy way to do this?
The code I run today change the colors but the problem is that the button you clicked stays red until you click it again. I want this to go automatically when pressing a new button.
Onselect: UpdateContext({pressedButton:!pressedButton})
Fill: If(pressedButton=true; Color.Transparent; Color.Red)
Solved! Go to Solution.
It's hard to tell what you have in your image...if this is a Gallery, then you can set the TemplateFill property as follows:
If(ThisItem.IsSelected, Red, Transparent)
If it is a button you have (which is not obvious in your image), then you can set the Fill property to the same formula above.
I hope this is helpful for you.
Am assuming your buttons are in a gallery (if not put them in a Gallery with ID ) such as:
That is, find a way of adding unique field into your table or collection if non existent already. Then put that on the Gallery.
After the above, try:
OnSelect
It's hard to tell what you have in your image...if this is a Gallery, then you can set the TemplateFill property as follows:
If(ThisItem.IsSelected, Red, Transparent)
If it is a button you have (which is not obvious in your image), then you can set the Fill property to the same formula above.
I hope this is helpful for you.
User | Count |
---|---|
167 | |
90 | |
73 | |
65 | |
58 |
User | Count |
---|---|
213 | |
153 | |
97 | |
88 | |
66 |