Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Clear / Hide items in gallery after selection

I followed the video from @ToddBaginski to build a people picker control. I was able to build the exact same control except that when we select a user, the gallery is still showing the selected user. I want to achive the below behavior,

  1. User enters a first few characters in the search textbox.
  2. Gallery displays all users fulfilling the search criteria.
  3. User selects one of them.
  4. The Display Name is populated in the same search box.
  5. The gallery displays 0 items.

Do we need to do some extra steps to achive this? Also not sure how the video shows a hand cursor when hovered over the rectangle. I don't think we can get a hand cursor over shapres.


Continued Contributor
Continued Contributor

Re: Clear / Hide items in gallery after selection

I haven't watched the video, but clearly on Step 4 you're putting the name into the same Search box that you are using as a Filter on your Gallery.  So if it contains the exact-match name of the person you clicked on (which you did in Step 3) it will display that matching item.

There are certainly several ways around this. 

First is just hiding the Gallery.  When you do your OnSelect for the Gallery you could also set a variable (e.g. UpdateContext({itemSelected:true})).  Then you can do the same for an OnChange for your Search text box (e.g. UpdateContext({itemSelected:false})).  Set the Visible property for the Gallery to be !itemSelected.

Again, I'm not clearly on the use-case (probably since I didn't watch the video), but you primarily just need to do something extra here to flag that something has been selected so now you want some different behavior to occur.

Helper I
Helper I

Re: Clear / Hide items in gallery after selection

Hi @jhall ,


Appreciate your response. However, not sure why, OnChange doesn't seems to be reliable and many a times fires only when the focus is lost. I am still getting the desired functionality by putting the same code OnSelect. I also added a condition that if the selected user display name is same as what is already there in the search text box, the search user function will not fire.

I will still wait for a couple of day expecting a reply from @ToddBaginski on what exactly has he used in the demo. If not, I will mark your response as an answer.

Helpful resources


New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,908)