Skip to main content

Fixed: New Control Lands Outside the Gallery Instead of Inside It in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

You select a gallery, insert a Text control, and it doesn't appear in the rows. It sits next to the gallery, outside it. With the gallery itself selected, Studio adds new controls beside it, not into its template. Select the template first.

The Problem​

In the example, the Career Development Plan app's My Plan screen had a gallery, galMyPlanMPS, inside a vertical container, conBodyMPS. With the gallery selected, Insert → Display → Text added Text1, but at the same level as the gallery in Tree view, not under it:

Tree view with conBodyMPS containing galMyPlanMPS and, at the same level instead of inside the gallery, Text1, outlined in red

There's no error message. The signs:

  • The new control isn't indented under the gallery in Tree view.
  • It doesn't repeat on every row.
  • ThisItem gives an error in its formulas, because only controls inside the gallery can use it.

Why It Happens​

Selecting a gallery selects the gallery control, not its template. A new control goes next to the selected control, in the same container. That's the same rule as elsewhere in Studio: insert with a control selected, and the new one lands in that control's parent. Microsoft's own tutorial warns to make sure you've selected the gallery's template, not the gallery itself, before inserting (Create a detail gallery).

The Fix: Select the Template, Then Insert​

  1. Undo the insert with Undo on the command bar, or Ctrl+Z.

  2. Select the gallery, then select the pencil icon at the top left of its first row, Edit gallery:

    The pencil icon labeled Edit gallery, outlined in red, at the top left of the gallery's first row

  3. Insert the control again.

This time, it appeared under galMyPlanMPS in Tree view, and a copy showed on every row once its Text was set to ThisItem.Competency:

The formula bar with ThisItem.Competency, and each gallery row showing its own competency name: Customer skill, Leadership, Coaching, Leadership and Pipeline management

Once the template has a control, selecting that control and inserting also adds the new one to the template.

The Same Problem When You Paste​

Paste follows the same rule. In Part 9, I copied the Review button from one gallery's rows to reuse it in another gallery, and chose ... → Paste on the second gallery. The copy, btnReviewTMS_1, appeared under the gallery instead of in its rows: in Tree view it sat next to galPlanTMS, not under it, and on the canvas it was one wide button below the list, with a red ⊗:

Tree view with btnReviewTMS_1 at the same level as galPlanTMS instead of under it, a wide Review button with a red error icon under the gallery on the canvas, and the App checker listing Name isn't valid. 'ThisItem' isn't... and The '.' operator cannot be used... on btnReviewTMS_1 .AccessibleLabel

The App checker's errors were Name isn't valid. 'ThisItem' isn't recognized. and The '.' operator cannot be used on Error values., on its AccessibleLabel, "Review " & ThisItem.Competency. ThisItem only exists inside a gallery's template, so they confirmed the copy was outside it.

The fix is the same as for inserting: Undo, then paste on a control that's already in the template. I chose ... → Paste on lblPlanCompetencyTMS, one of the row's labels, and the copy landed under galPlanTMS, in every row.

Common Mistakes​

MistakeWhat happensDo this instead
Dragging the misplaced control onto the galleryIn a layout container, controls can't be draggedUndo and insert again with the template selected
Copying the control into every row by handSeparate controls that don't follow the dataOne control in the template repeats itself

Troubleshooting​

SymptomLikely causeFix
No pencil iconThe gallery isn't selectedSelect the gallery first
The control still lands outsideSomething other than the template was selectedSelect the pencil again, or a control inside the template
A pasted control lands outsidePaste was chosen on the gallery itselfUndo, then paste on a control inside the template

FAQ​

How do I know the template is selected?​

Microsoft describes the selection as a bounding box slightly inside the gallery's edge and shorter than the gallery. Inserted controls then appear inside the gallery in Tree view.

What if I've already set up the misplaced control?​

Undo is simplest. Otherwise, insert a new control with the template selected and set it up again.

Conclusion​

A control inserted with the gallery selected lands next to the gallery. Undo, select the template with the Edit gallery pencil, and insert again; it then repeats on every 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.