I have a gallery that show different alternatives for the user to select one. These options comes from another table. I would like to make the checkbox in a way that user can only select one. None of the methods I saw worked for me. Any suggestions?
Solved! Go to Solution.
Hi @MiracleMan ,
You can achieve the single checkbox by a Gallery.
First, add a nested gallery2 inside the gallery1, set the Gallery2.Items to another table you mentioned. Then add a checkbox into gallery2, set Text property to ThisItem.ColumnName.
Next, configure the single-check function. Since the gallery can only be single-selected, set Checkbox.Default property: ThisItem.IsSelected, when the gallery item is selected, the checkbox is also checked.
However, It was found in the test that there were some conflicts between checkbox and Gallery Item, it didn't work as expected.
The workaround is here: Add a Blank Label into Gallery2, to be front of the checkbox, And set the Visible property: !ThisItem.IsSelected || !Checkbox1.Value. Use Label to avoid the selection conflict between the checkbox and Gallery Item.
Here we go.
Hope this helps.
Sik
Hi @MiracleMan
It sounds like you want a Radio control. ref. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-radio
Can it be done with a Radio control? I tried but I wasnt able to figure out how the assign the field to the radio.
Also, I did the radio thing (living the default text) and it allowed me to click all of them.
You would do it similar to how you use a dropdown control, either hard code the choices like ["Choice1", "Choice2", etc] or you can use Distinct(yourdatasource, yourselectedcolumn) as the Items property. If you are using it to display choices in a Gallery, set the Default property of the Radio control to the Item as
LookUp(yourdatasource, ID = ThisItem.ID, yourselectedcolumn)
Hi @MiracleMan ,
You can achieve the single checkbox by a Gallery.
First, add a nested gallery2 inside the gallery1, set the Gallery2.Items to another table you mentioned. Then add a checkbox into gallery2, set Text property to ThisItem.ColumnName.
Next, configure the single-check function. Since the gallery can only be single-selected, set Checkbox.Default property: ThisItem.IsSelected, when the gallery item is selected, the checkbox is also checked.
However, It was found in the test that there were some conflicts between checkbox and Gallery Item, it didn't work as expected.
The workaround is here: Add a Blank Label into Gallery2, to be front of the checkbox, And set the Visible property: !ThisItem.IsSelected || !Checkbox1.Value. Use Label to avoid the selection conflict between the checkbox and Gallery Item.
Here we go.
Hope this helps.
Sik
Hi @v-siky-msft ,
I have gone through your solution it's working in a way but for selecting one checkbox its taking two mouse clicks. Could you please help me on this.
Thanks in advance.
by fault I am getting 1 checkbox as checked. I want to have all checkbox as unchecked by default. Can you please guide me how to achieve this.
How to use one checkbox at a time inside the Gallery. If i choose one among two checkboxes, other box should be unchecked automatically.
Hi @v-siky-msft Your solution work just fine but now the OnCheck and OnUncheck property of check box is not working at all
Your solution work just fine but now the OnCheck and OnUncheck property of check box is not working at all. If the checkbox is checked i need to collect the checked item into check box but when i check the check box its value flip to true but collection is not collecting any value. Can you help ?
For Further details see :https://powerusers.microsoft.com/t5/Building-Power-Apps/Checkbox-On-Check-and-On-Un-Check-in-nested-...
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |