Skip to content
Home » Highlight selected item in gallery power apps

Highlight selected item in gallery power apps

This article demonstrates how to highlight the selected item in gallery control in Power Apps.

As you can see below app screen, there is one gallery control and by default, a first item in gallery is always auto selected.



As all the items, or rows in a gallery are having same background color so, it is hard to tell which item is selected in gallery.

Lets, highlight the selected row in gallery for this we need to modify the TemplateFill property of gallery. TemplateFill allows us to color individual row in gallery.

Select the gallery control and go to TemplateFill property.
You can see, the color of row is RGBA(0, 0, 0, 0) that is white color.

Lets, change the color of row to blue for selected row only in gallery.

The below code checks, if the row is selected then change the color to blue otherwise keep it white.

The ColorValue function used here, returns a color based on a color string in a CSS. So, you can provide color name, 6 digit hex value, or 8 digit hex value as well. In our case, we have provided 6 digit hex value for blue color.

If(ThisItem.IsSelected,
ColorValue("#99CFEC"),
RGBA( 0, 0, 0, 0 )
)

Once you done with the above step, you will see the first row in gallery is highlighted in blue color.

Lets, select the another row in gallery to verify whether it is working properly or not.

You can see, this time we have selected third row in gallery and its color gets changed to blue.





 

Also Read..

Validate Email in Power Apps

Add Alternate background color to rows

Sort Items in gallery Power Apps

Change Item color in gallery based on value

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.