Hello all,
I'm refreshing some of mine (little 😉 )knowledge in Powerapps. I found out how to color a selected item in a gallery via 'template fill'.
If (ThisItem.IsSelected;Green;GhostWhite)
Know I also want that when I unselect an item by clicking on the selected item that the color changes again to 'GhostWhite'.
Can anybody help me with that.?
Do I need to work with the OnSelect or with the 'TemplateFill'?
Big tnx
Siegfried
Solved! Go to Solution.
You cannot have an unselected row in a Gallery...there is always something selected. So, if you are basing off of IsSelected, you will have something with the Green color always.
If you are trying to create the illusion of something selected or not, then you will need to resort to a snapshot variable to get the illusion you want.
Ex. on the OnSelect of your Gallery, the following: UpdateContext({lclSelected: If(ThisItem.ID = lclSelected; 0; ThisItem.ID)})
Then in your TemplateFill:
If(ThisItem.ID = lclSelected; Green; GhostWhite)
I hope this is helpful for you.
You cannot have an unselected row in a Gallery...there is always something selected. So, if you are basing off of IsSelected, you will have something with the Green color always.
If you are trying to create the illusion of something selected or not, then you will need to resort to a snapshot variable to get the illusion you want.
Ex. on the OnSelect of your Gallery, the following: UpdateContext({lclSelected: If(ThisItem.ID = lclSelected; 0; ThisItem.ID)})
Then in your TemplateFill:
If(ThisItem.ID = lclSelected; Green; GhostWhite)
I hope this is helpful for you.
Tnx, did'nt know that in a Gallery there is always something selected.
Yep...always something!
User | Count |
---|---|
250 | |
102 | |
94 | |
47 | |
37 |