How to reset the selected item of a Gallery in Canvas app?

I am back with another blog on Power Apps and this again is about a frequently asked question – “How do I reset the selected item in Gallery in Power Apps Canvas app? “.

You might be wondering, won’t it be as simple as calling the Reset function of the gallery control. Well, I assumed the same. Let’s see what’s the issue with the Reset function. Below is a sample demo with the Reset function in action.

As you can see in the above video, when you Invoke the Reset function of the gallery, the first item is selected. And quite obviously there if you have a formula to set the background colour, the first item in the gallery shall maintain the selected background item colour.

In case you are wondering about the formula on Reset button click. here it is below.

Reset selected item of a Gallery in Canvas app

Sometimes it’s more of stuffs which we take for guaranteed that make life difficult for us when it does not work out. Fortunately after much struggle, I could find the solution to this.

All you need to set the Default property of the Gallery to {}

Reset selected item of a Gallery in Canvas app

Below is the behavior after setting the Default Property.

Working as expected!

Hope this helped. You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading