Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

Condition color change form checkbox

Hi, again.


I have a frontpage with a circle in to represent task status. On an other screen I've got a gallery with tasks and checkboxes. My goal is to make this one single circle turn green when all the boxes are checked, and red as long as not every single one is checked. 


I used an If statement and so on, but the circle turns green as long as just one is checked.


Any advice?


Accepted Solutions

I suggest you follow these steps:

1. Insert a Label Example Label1 into the Gallery say Gallery1 {The Label will appear in each row of the Gallery as your checkbox) --- You can hide the Label


2. In the Text Property of Label1, put : 



3. On the OnSelect of the Button that navigate to the Frontpage put:






4. Finally in the fill property of the Circle icone on the frontpage:



If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Super User
Super User


Post your If statement and we can try to fix it for you.

I totally forgot my code, sorry.


For the circle object I used this:


If(CheckBox_Annet.Value=true; green; red)


I've got Norwegian as language, therefore the semicolons and not commas.


On the checkbox "OnCheck" to true and OnUncheck to false.


If you have more than 1 checkbox that needs to be considered then the If statement needs to be.


If(CheckBox_Annet&&Checkbox2&&Checkbox3; Green; Red)


The If statement resolves  to either true or false.  There is no need for the .Value as it is implicit.  All of the checkboxes need to be true for the entire statement to be true.  There is also no need for the OnCheck or OnUncheck properties to be changed either.



I suspected as much. Thank you so much. But what if the number of checkboxes exceed the number I've acounted for in the code? Is there some kind of Len() function to deal with this? Or do I have to set a maximum number of possible tasks and hardcode that number?

Super User
Super User


I believe you are overthinking the problem.  Checkbox controls are either true or false.  In any formulas that you use, you can just use the name of the checkbox control and it will resolve to either true or false depending on whether it is checked or not.  

I'm very prone to overthinking I'm afraid.


The app is just a tasklist where people can add and check out tasks. The issue is that I dont want the Frontpage circle to change to green before all the tasks in the gallery are checked. In the pic, if I just check one box, then the circle turns green.




Super User
Super User

Hi @AndyNorw 

If you use the formula that I gave you in the Color property of the circle with all of the checkbox names chained with &&, then the color won't turn green until all of the checkboxes are checked. 

Hi again @Drrickryp , and sorry for being slow.


I tried the code, but I get an error; "Name invalid. This identifyer is not recognized"


The other checkboxes doesn't have a individual name, just the first one. The checkboxes after the first one gets autogenerated when i create a new task. I just set the first one on the top of the gallery.

Super User
Super User

I didn't quite get that you have the checkbox in a gallery.  I will have to rethink this.

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,617)