Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Question: Gallery Item Template Fill on a button pressed in that Gallery Item

Hello powerusers!

I have a quick question about a gallery I am using in a current project. 


I am trying to find a way to make it so that the templateFill on a specific item in the gallery is updated when one of the buttons in that Gallery Item is pressed, and only for that item is the templateFill set. 


Here is the code I have currently in the button:

Set(ButtonPressed, true)

I know the above code creates a global variable which is why all templateFills are all being set. I need to be able to set the button as pressed for that individual item in the gallery. The template fill code is set as:

If(ButtonPressed, RGBA(244, 115, 33, 1), RGBA(0, 0, 0, 0 ))

What can I change in the above samples to create a button that updates that individual fill for that item? 

Thanks for the help in advance! 

Super User
Super User

Re: Question: Gallery Item Template Fill on a button pressed in that Gallery Item


You need to have an individual column in your gallery list that will allow you to alter its value and thus you can "trigger" off of that.


I've attached a sample app that you can take a look at.  In there you will see this concept demonstrated.

Key items to review in the app:

1) OnStart - contains a simple collection to act as the datasource in this app

2) Fill My List button - OnSelect - in here we create the collection for the gallery and add the column that will be used to indicate the "state" of the row.  We set it to false as a default.

3) Gallery - pretty basic.  Datasource is the collection from #2 above and two labels for the sample data and an icon.

Take a look at the TemplateFill property on the gallery.  You will see the logic for the colors.

4) The icon in the gallery template - OnSelect property - here we patch the column in the current record in the gallery to toggle the true/false condition.


I hope that it is clear and helpful for you.

Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Level: Powered On

Re: Question: Gallery Item Template Fill on a button pressed in that Gallery Item

I will check this out right away. If I can get it working I will mark it as a solution.

Thank you! 

Helpful resources

New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,726)