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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to know what item ...
Power Apps
Unanswered

How to know what item is currently viewing in gallery

(0) ShareShare
ReportReport
Posted on by 15

I have a gallery with items within it. The gallery is the same width of the template width, so only one item shows at a time. And I have navigation enabled to show the arrows. Is there a way another element (e.g. a label) on the screen could know what item is currently being viewed in the gallery? Obviously there is the "Selected" parameter of the gallery, but that only updates when the user selects the item in the gallery, rather than just navigating to it. Perhaps there is a way I could force the user to select the item when they navigate to it, so Selected is the correct one?

 

Would be grateful for any ideas or solutions!

 

Thanks in advance 🙂

Eddie

Categories:
I have the same question (0)
  • Verified answer
    JasonZF Profile Picture
    572 on at

    If the data source for the gallery is a collection, there may be another way to go about this. Instead of the navigation arrows, make your own custom next and previous buttons, and then only have the gallery display the nth record of the collection. The next button would increment a variable, and the previous button would reduce the variable. This variable would be used in the Gallery's items function via an Index(Collection,varItemNumber) formula. You could even have a CountRows() function somewhere to determine how many records there are, then have the button disabled when the end or beginning is reached.

  • eddiecoldrick Profile Picture
    15 on at

    Hi Jason. I have just finished implementing exactly that... Great minds think alike! 😉 It works really well and I really did use all the functions you have mentioned just before you posted, including CountRows. Shame the default gallery has these limitations though.

     

    Thanks!

    Eddie

  • JasonZF Profile Picture
    572 on at

    As an example, on the OnVisible of my screen, I'm collecting the English alphabet into a collection, setting varSelectedItem to 1, and then performing a CountRows() on the collection. Then my gallery has this in the items:

    Index(
     colAlphabet,
     varSelectedItem
    )

    The "Next" button:

    UpdateContext({varSelectedItem:varSelectedItem+1})

    The "Previous" button:

    UpdateContext({varSelectedItem:varSelectedItem-1})

    The DisplayMode of the next button:

    If(
     varSelectedItem = varItemCount,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    And the same on the previous button:

    If(
     varSelectedItem = 1,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

     

    JasonWS_0-1692271825843.png

     

  • JasonZF Profile Picture
    572 on at

    Agreed. Glad it worked out. Making your own buttons opens up the possibility of designing them to match the rest of your app too, as the existing navigation buttons don't look all that great. I may actually utilize this in some of my apps to click through attachment photos. I do wish the gallery has some more capabilities.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard