Skip to main content

How to Use Self and Parent in Power Apps

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Formulas often need a property of the control they're on, or of the control that holds it. Self is the current control and Parent is its container, so you don't have to type control names, and the formula still works when you copy the control or rename it.

What They Are​

Microsoft describes three ways to refer to a control: by its name, with Self for the current control, and with Parent for the control that hosts it, such as a screen, a container or a gallery (Self and Parent operators).

They're operators, not properties, so Parent.Parent, Self.Parent and Parent.Self aren't supported.

Example 1: Self in an Accessible Label​

A Text control's accessible label can repeat its own text, and stays right when the text changes:

lblEmptyMPS → AccessibleLabel
Self.Text

The formula bar with the AccessibleLabel property of lblEmptyMPS set to Self.Text, and the preview strip reading Self.Text = There's no plan for Managing Director yet. Competencies appear here once a manager adds them, with Data type text

Example 2: Parent to Fill the Screen​

A screen's main container takes the screen's size:

conMainMPS → Width
Parent.Width

Here Parent is the screen, 1366 wide at the default canvas size:

The formula bar with the Width property of conMainMPS set to Parent.Width, the preview strip reading Parent.Width = 1366 with Data type number, and the container selected on the canvas

On a phone, the same formula gives the phone's width. That's what makes a container-based screen responsive (How to Add a Vertical Container in Power Apps).

Example 3: Parent in a Gallery's Template​

In a gallery's template, Parent is the gallery, and TemplateWidth is the width of one row:

lblCompetencyMPS → Width
Parent.TemplateWidth - 32

With the cursor on Parent.TemplateWidth, the preview strip showed 1302, so the text is 1270 wide, leaving 16 on each side:

The formula bar with the Width property of lblCompetencyMPS set to Parent.TemplateWidth - 32 and the preview strip reading Parent.TemplateWidth = 1302 with Data type number

A Limit: Not Every Property Can Be Read​

Self reaches the properties a control lets other formulas read. The modern Badge didn't let its Content be read in the example: Self.Content gave Name isn't valid. 'Content' isn't recognized.

Common Mistakes​

MistakeWhat happensDo this instead
Typing the control's own name in its formulasBreaks or misleads when the control is copiedUse Self
Parent.Parent to reach two levels upNot supportedRefer to that control by name
Expecting Parent in a gallery template to be the gallery's containerIt's the galleryUse TemplateWidth for the row's width

Troubleshooting​

SymptomLikely causeFix
Name isn't valid after Self.The control doesn't expose that property for readingUse the value's source instead
A control doesn't resize on a phoneIts size is a fixed numberBase it on Parent

FAQ​

Is Self faster than a control's name?​

Microsoft presents it as easier and more portable, not faster: the formula works on any control you copy it to.

What's Parent for a control directly on a screen?​

The screen.

Conclusion​

Self.Property is the current control's property and Parent.Property its container's. Use them for labels, sizes and anything else that should follow the control around.

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.