Using checkbox in a canvas apps gallery

This article illustrates about using the checkbox inside a gallery in canvas apps

Step 1: Create a gallery and set the properties of the gallery as below:

Data source : Contacts
Layout: Title
Clear the default value in the title
GalleryProperty

Step 2: Add checkbox from the input options inside the gallery and set the “Text Property” of the checkbox to ‘Full Name’ from the Contact.
Now this will display the Contact’s Full Name next to the check box

checkbox

Step 3: Add the checked items in the gallery to a collection
This is done by setting the “OnCheck” property to “Collect(checkedcontacts,{name:Gallery1.Selected.’Full Name’})

checkedcollection

Step 4: Remove the items from the collection when the item in gallery is Unchecked
This is done by setting “OnUncheck” property to :
Remove(checkedcontacts,First(Filter(checkedcontacts,name = ThisItem.’Full Name’)),All)

Uncheck

Step 5: To test this, add a data table and set the items property as in the Image below.

Datatable

Step 6: Go to the fields property of the data table click edit and chose the field as below

DataField

 

Step 7: Play the app and test it by checking and unchecking the checkbox in a gallery and view the corresponding data in the data table

TestCheck

 

 

 

 

 

 

Thanks,
Shayan