web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to force selection...
Power Apps
Unanswered

How to force selection of a Gallery item in PowerApps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am using a Gallery as tab navigation and I have a simple scenario where I want to navigate to a specific tab when I click a button...all on the same screen.

My gallery collection is as follows:

ClearCollect(HomeActionCollection, Table({Name:"Create Request"},{Name:"Your Requests"});

 

I set a variable OnStart to identify which tab to select first:

Set(HomeActionSelected,"Create Request")

 

I set the Gallery default as follows:

Gallery.Default = LookUp(HomeActionCollection, Name=HomeActionSelected)

...shows the first item onStart...

 

I have a button click that does:

Set(HomeActionSelected,"Your Requests")

...The Gallery item is not selected.

 

How can I make this work?

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I also tried to reset the collection on the button click like:

     

    Set(HomeActionSelected,"Your Requests"); ClearCollect(HomeActionCollection, Table({Name:"Create Request"},{Name:"Your Requests"})

     

    Amazingly it worked! BUT ONLY ONE TIME...If I clicked on another tab and then clicked the button again it did not change the gallery selection.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This does work if you add a Clear call first before ClearCollect.

     

    Set(HomeActionSelected,"Your Requests"); 

    Clear(HomeActionCollection);

    ClearCollect(HomeActionCollection, Table({Name:"Create Request"},{Name:"Your Requests"})

  • MisterMagoo Profile Picture
    81 on at

    unfortunately it is not working for me, even with a "Clear" before the ClearCollect! 

  • bfing Profile Picture
    40 on at

    I realize this is a very old post, but I happened across it and i figured I would chime in. 

    The way I accomplish this is to define a context variable that gets updated by selecting a gallery item, and all other on-screen controls are updated based on the context variable instead of Gallery.Selected.  This approach has the added benefit of being able to browse to the screen with the gallery and pass a predefined context variable through the Navigate function and "select" other gallery items from other on screen controls (such as a search feature, or separate button press, etc.)

     

    I hope this helps you or someone else that happens across this question like I did.

  • johnnykalsi Profile Picture
    143 on at

    3 years later this problem still has no solution

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard