Auto-Scroll in a Power Apps Gallery
June 27, 2024•137 words
Let say we have a Gallery that has many items in it, and we want to automatically scroll to a specific item when the screen loads (or some other event). We can do this by setting the Default property in the Gallery.
Update the Default property of your Gallery to something like the following:
LookUp(colDemoCollection, Id = Value(Coalesce(txtSelectNumber.Text, 1)))
The above formula uses a LookUp function that filters the colDemoCollection (the data source of the Gallery) for an ID (a column in the collection) that matches the entered text. The coalesce function ensures if no text value is provided, it defaults to 1.
This approach could be useful when using a Gallery for Navigation or to jump to a specific record that we want the user to see based on a selection from another control.