Skip to main content

How to Open Another Screen When a Gallery Row Is Selected in Power Apps

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A list is more useful when each row opens its details. In Power Apps, that takes three settings: make the gallery Selectable, navigate from its OnSelect with the selected row, and give each row a button so keyboard users can open it too.

Prerequisites​

The example is the Career Development Plan app: galMyPlanMPS on the My Plan screen lists competencies, and each should open the Response screen.

Set the gallery's Selectable to true. Microsoft's reference explains the difference: when it's true, "screen readers identify the gallery as a selectable list", and when it's false, selecting an item doesn't select it (Gallery control).

galMyPlanMPS → Selectable
true

Step 2: Navigate from the Gallery's OnSelect​

The gallery's OnSelect runs when someone selects a row. Open the details screen there, and pass the row with Navigate's third argument:

galMyPlanMPS → OnSelect
Navigate('Response Screen', ScreenTransition.None, {locPlanItem: ThisItem})

ThisItem is the row that was selected (How to Use ThisItem in a Power Apps Gallery). The record arrives on the other screen as the context variable locPlanItem, so that screen can show locPlanItem.Competency and the rest:

The formula bar with the OnSelect property of galMyPlanMPS set to a Navigate to 'Response Screen' that passes ThisItem as locPlanItem, and the gallery rows Customer skill and Leadership, each with an Open button

warning

Passing Self.Selected instead gave the error Incompatible type in this gallery. See Fixed: "Incompatible Type… Context Variable Types Are Incompatible".

Step 3: Add a Button for Keyboard Users​

A mouse or a finger can select anywhere in a row. Microsoft's keyboard guidance for galleries asks for a way to do the same with a keyboard, "for example, adding a Button that has its OnSelect property set to Select(Parent)".

Select a control inside the row first, so the new button goes into the row's template, then Insert → Input → Button (How to Add a Button in Power Apps). In the example, the new button's OnSelect was already Select(Parent):

The formula bar with the OnSelect property of btnOpenMPS set to Select(Parent), and the gallery on the canvas with an Open button selected in the first row

Select(Parent) passes the press to the gallery, so the button and the row run the same OnSelect (How to Use the Select Function in Power Apps). The example's button settings:

PropertyValue
NamebtnOpenMPS
Text"Open"
AccessibleLabel"Open " & ThisItem.Competency
AppearanceButtonAppearance.Secondary
Width, Height96, 40
XParent.TemplateWidth - Self.Width - 16
Y(Parent.TemplateHeight - Self.Height) / 2

The accessible label names the row, so a screen reader says Open Customer skill, not just Open. Leave room for the button: the example's text controls became Parent.TemplateWidth - 144 wide.

On phones, a 96-pixel button can leave the text too little room. How to Show Only the Icon on a Button on Phones shows it as a chevron there and lets the text's width follow the button.

Step 4: Test It​

Preview the app and select a row's Open button. In the example, Open on Customer skill opened the Response screen with that competency:

The My response screen in preview for Customer skill, Level Intermediate, with a Not started badge, a text box and a Send to manager button

Common Mistakes​

MistakeWhat happensDo this instead
Leaving Selectable falseSelecting a row doesn't select itSet it to true
Inserting the button with the gallery selectedIt lands next to the gallery, not in each rowSelect a control inside the row first
Navigating from the button with its own formulaTwo places to keep in stepKeep Select(Parent) on the button
A button labeled only "Open"Screen readers can't tell rows apartAdd the row's name to AccessibleLabel

Troubleshooting​

SymptomLikely causeFix
Names are cut off on phonesThe button takes most of the rowShow only its icon on phones (Fixed: Text and Buttons Cut Off on Narrow Phones)
The new screen shows nothingIt was opened from the tree, not from a rowTest in preview, starting on the gallery's screen
The button does nothingIts OnSelect was changedSet it back to Select(Parent)
Incompatible type on OnSelectSelf.Selected stored in a variablePass ThisItem

FAQ​

Why not use Gallery.Selected on the next screen?​

Selected can change when the gallery's data changes, which Microsoft's gallery best practices warn about. Passing the row once, when it's selected, gives the next screen a stable copy.

Do I need the button if people use a mouse?​

The button is for everyone who uses a keyboard or a screen reader, and it also makes the action visible.

Conclusion​

Set Selectable to true, navigate from the gallery's OnSelect with ThisItem, and add a button with Select(Parent) in each row, with an accessible label that names the row.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.