Recently a few times I’ve been asked about how to make controls visible or invisible depending on the value selected in dropdowns, combo boxes and various other controls. In this post I’m going through the most common controls used for this.

Controls

Power Apps has many controls available to help you develop your apps. Quite often when you develop apps that need to contain forms you will need fields to appear or disappear depending on the values selected in fro example a dropdown.

For most controls we have the Visible property that controls the visibility of that control

Use a control to set the visibility of the text
Use a control to set the visibility of the text

But how do we check the values of dropdowns, combo boxes, toggles, checkboxes and radio buttons?

Classic Dropdowns

When we have a dropdown and we want to make a text only visible when a specific value has been selected. Then we can set the Visible property to any of the following options. Where I have a Dropdown with just a Value property. If however you have records in your Dropdown then any property can be selected here instead of Value.

Dropdown1.SelectedText.Value = "Yes"
Or
Dropdown1.Selected.Value = "Yes"
Or
Dropdown1.SelectedText.Value = "1"
Or
Dropdown1.Selected.Value = 1

Important to note here that if you make use of the SelectedText property that we always have a Text value even if the item in the dropdown are numbers.

Dropdown menu displaying the number 1 with an arrow for expanding options, labeled 'Is equal to 1'.
Controls to set the visibility of other controls 1

Classic Combobox

Comboboxes are slightly more complicated than Dropdowns. The main complexity is around the setting to sllow multiple selections or not.

User interface settings panel showing options for 'Allow multiple selection' and 'Allow searching' with on/off toggle switches.
Controls to set the visibility of other controls 2

If we first assume that Allow multiple selections has ben enabled then the Combobox’s Selected property hold the item record that was selected most recently.

Screenshot of a user interface displaying a ComboBox with four items: Item 1, Item 2, Item 3, and Item 4. The selected value is indicated as 'Item 4'.
Controls to set the visibility of other controls 3

However, most likely using the SelectedItems will give you the result that you are looking for.

Screenshot of a user interface featuring a combobox with items labeled 'Item 1', 'Item 2', 'Item 3', and 'Item 4'. The interface also displays a formula related to the combobox selection.
Controls to set the visibility of other controls 4

If we now disallow multiple selections, then we will find that both options will work and therefore the much simpler option of Combobox1.Selected will have the preference.

Or alternatively you can go for this contruction:

CountRows(Filter(ComboboxCanvas1.SelectedItems, Value = "Item 2")) = 1

Classic Radio Button

For Classic Radio Button we can use the Selected.Value or SelectedText again.

Radio1.Selected.Value = 2
or
Radio1.SelectedText.Value = "2"
Screenshot of a user interface showing a tree view with screens and components, featuring a radio button selection labeled 'Radio' with options 1 and 2, and a condition stating 'Is equal to 2'.
Controls to set the visibility of other controls 5

Classic Checkboxes

Checkboxes are very different. A checkbox has a Boolean value telling you if the checkbox has been checked or not.

User interface displaying a tree view on the left and a checkbox labeled 'Option' on the right, which is currently checked.
Controls to set the visibility of other controls 6

This means that if you had multiple check boxes ( trying to mimic a multi select radio button then you would have to check multiple checkboxes for their value as shown below:

Or(Checkbox1.Value, Checkbox2.Value)

Classic Toggle

Classix Toggles are a bit like the checkboxes. We can simply look at the Value property.

Screenshot of a user interface displaying a tree view structure on the left with components like 'New screen', and a toggle switch labeled 'On' on the right with a text field indicating 'Is Checked'.
Controls to set the visibility of other controls 7

Modern Dropdown

If we now have a look at the Modern Dropdown

Modern Dropdown controls have Selected and SelectedItems
Modern Dropdown controls have Selected and SelectedItems

Using the Selected property you can find the selected option as follows.

Screenshot of a dropdown menu in a software interface, displaying 'Modern Dropdown' with 'Item 1' selected and a formula bar showing the selection code.
Controls to set the visibility of other controls 8

Alternatively, you could also use SelectedItems however as there is now multiselect option available in Modern Dropdown there is no real benefit for doing this.

First(DropdownCanvas1.SelectedItems).Value = "Item 1"

Modern Combobox

Like with the classic Combobox the Selected.Value will hold the most recently selected item. So this will work in both cases where we allow or disallow the multi select, however When you have a multiselect you most likely will want to user the SelectedItems

Screenshot showing a modern combobox interface in a design software, highlighting the selected value 'Item 2'. The tree view on the left indicates screens and components.
Controls to set the visibility of other controls 9

Using the SelectedItems with this expression is preferred for multiselect Comboboxes

CountRows(Filter(ComboboxCanvas1.SelectedItems, Value = "Item 2")) = 1

Modern Radio buttons

For Modern Radio button’s we once again have selected and SelectedItems available. As Radio buttons are always single select there is no real need to use SelectedItems.

Screenshot of a user interface showing a radio button group with three items labeled 'Item 1', 'Item 2' (selected), and 'Item 3'. A text field indicates 'Item 2 is selected'.
Controls to set the visibility of other controls 10

Modern Check boxes

Unlike Classic Checkboxes, modern checkboxes have a property Checked. The Checked property is a Boolean that tells you if the checkbox has been checked or not.

Screenshot of a PowerApps interface showing a modern checkbox labeled 'Checkbox' that is selected, along with details about the checkbox status in a formula bar.
Controls to set the visibility of other controls 11

Modern Toggle

For the modern toggles we have like the check boxes a Checked property. This property tells us if the Toggle has been switched on (true) or off (false).

Screenshot of a user interface displaying a modern toggle switch labeled 'Label' with a status indication of 'Is selected' on the right side.
Controls to set the visibility of other controls 12

Classic vs Modern Controls

As you can see from the many examples in this post the behaviour of the various controls isn’t consistent. And quite a few controls use the SelectedItems property even if there is no multiselect available. This all may lead to bugs that are hard to find. Understanding the nuances between the various options is important if you want to create robust apps.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.