Latest Posts

PowerApps refer current control within its own properties


The Self function in PowerApps is a reference to the current control within its own properties. This can be particularly useful when you need to refer to the properties of a control within the same control, such as adjusting its appearance or behavior based on its own state.

PowerApps – Self() function Syntax

Self.PropertyName

  • PropertyName: The property of the current control that you want to reference.

Notes:

  • Nested Controls: The Self function refers to the current control's context, so it might not work as expected if used in nested controls without careful handling.

PowerApps - Change color of control Based on its value

Suppose you have a slider control, and you want the fill color of the slider to change based on its value. You can use the Self function in the Fill property of the slider:

If(Self.Value > 50, Color.Red, Color.Green)

This changes the slider's fill color to red if the value is greater than 50, otherwise, it changes to green.

PowerApps – Apply dynamic tooltip based on control text

You can set a dynamic tooltip for a button based on its text content using the Self function. In the Tooltip property of the button:

 

"Click to submit: " & Self.Text

This sets the tooltip to display "Click to submit: " followed by the button's text.

PowerApps – implement button hover effect

To create a hover effect where the button changes its color when the user hovers over it, you can use Self in the HoverFill property:

If(Self.Hover, Color.LightBlue, Color.Blue)

This changes the button color to light blue when hovered, otherwise, it remains blue.

PowerApps – implement Adaptive Label Width

Suppose you have a label and you want its width to adapt based on its text length. You can use Self in the Width property of the label:

TextWidth(Self.Text) + 20

This sets the width of the label to be slightly larger than the width of its text content.

PowerApps – Dynamic Progress Bar

If you have a progress bar represented by a rectangle and you want its width to adjust based on a percentage value, you can set the Width property of the rectangle using Self:

Parent.Width * (Self.Value / 100)

This sets the width of the progress bar proportionally based on its value.

PowerApps – implement dynamic hint text of control

Suppose you have a text input control where users can type their names, and you want the text input box to display a placeholder text when it is empty. You can use the Self function in the HintText property of the text input control:

  1. Add a Text Input Control

Add a text input control and set its HintText property to:

If(IsBlank(Self.Text), "Enter your name", Self.Text)

This sets the hint text to "Enter your name" when the input is empty.


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint