When building a business solution, one often has the requirement to hide/unhide a control (or group of controls) when a certain condition is met. With PowerApps, this can be done but one must know how.
Directly changing the Visible
property is not possible. This can get used to depending on your previous experience with other tools to build business solutions.
There are 3 options:
- Using a variable
- Using the if function
- Using a rule
Which option to use depends on the conditions.
Using a variable
This option allows you to set the visibility outside the control to hide/unhide. For instance, you can set the variable to “false” in the property OnVisible
of the screen and then to “true” when a certain event occurs, like when a button is clicked (or better said: When the event OnSelect
of a button occurs).
This option is often to be preferred when the trigger to hide/unhide a control is based on a OnSelect
/OnChange
event on another control.
Using the if function
This option defines the condition to hide/unhide the control in its property Visible
. Property values of other controls are used to determine the condition. For example:
If(Dropdown1.Selected.Value="One", true, false)
This option is often to be preferred when the trigger to hide/unhide a control is based on a property value of another control.
Using a rule
This option is comparible with the previous one, except that the rules functionality of PowerApps is used. For now, I consider this option more of a hassle than needed.