web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get Label Fill to chan...
Power Apps
Unanswered

Get Label Fill to change based on CheckBox (Issue with Reset)

(1) ShareShare
ReportReport
Posted on by 24
Hello-
 
I have a gallery that has items with checkboxes.  When I check the boxes the color of textboxes turns a light grey.  When I reset the gallery the checkboxes are cleared (un-ticked).... however the color of the textboxes will now turn to all light grey.  I would have expected them to reset and go back to white smoke (lighter color).  Here is an image of the unexpected behavior after a reset of the gallery.  I believe I need some help with context.  Please note these checkboxes are modern controls.
 
Not what I want:
 
 
 
Behavior I expect to see:
 
 
 
Code that resets the gallery and somehow changes all the textboxes to LightGrey even though checkbox is false????
 
 
    UpdateContext({_SaveScreen:true});
    
        ForAll(
           Filter(galDDUListEdit.AllItems, chkSelect.Checked=true) As SubSet,
                Patch(
                    DDU_List,
                    LookUp(DDU_List, ID=SubSet.ID),
                    {Selected_for_Discontinuance:{Value:cboDDUEditSelectDis.Selected.Value}}
                )
        );

    Reset(galDDUListEdit);
    //UpdateContext({CheckboxState:false});
    UpdateContext({_SaveScreen:false});
 
 
 
 
 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,351 Super User 2025 Season 2 on at
     
    After you do that, if you check one manually and uncheck, does it act properly? how are you "resetting" the gallery?
  • mrmmickle1 Profile Picture
    24 on at
    @Michael E Gernaey
     
    I'm resetting the gallery like this:
     
       Reset(galDDUListEdit);
     
    After the gallery is reset if I check a box they work as expected.  i.e. I check the box and it stays the same light gray color it should be.  I uncheck it and it turns to whitesmoke.
     
    What I don't understand is why all the text boxes turn to LightGray?  The checkbox is not checked so the evaluation is not triggering? Or it is seeing them as "true" for some reason?  Which is confusing as the evaluation in the above image clearly indicates it as "false"...
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    What is the default value of the checkboxes?
    If they are not evaluated they will remain at the default value.
    I presume that checking them and unchecking them works correctly.
  • mrmmickle1 Profile Picture
    24 on at
     
    As far as I can tell there is no Default property for this modern checkbox?  When they load initially, they are always false.  They also show false after the reset.  It is only the text boxes color that is indicating they are "true" by displaying the color they should be when they are "true".... which is wrong as they clearly say false in the image.
     
    Should I try to use the legacy checkbox?  I feel like I had this issue again with another app I built and ended up getting rid of this behavior all together out of frustration.  Seems like this would be much easier to fix...
  • mrmmickle1 Profile Picture
    24 on at
    Just wanted to check back in and see if anyone may have seen this behavior before and know:
     
    1. Why it is happening?
    2. How to overcome the issue?
  • mrmmickle1 Profile Picture
    24 on at
    Is there a way to toggle the color of the checkbox after a reset.  This formula clearly evaluates to WhiteSmoke.... however the textboxes are LightGray in color.  Is this some kind of a bug?
     
    How do I report bugs to MSFT?
     
    WhiteSmoke Color:
     
    LightGray Color:
     
     
    My Formula is evaluated as WhiteSmoke... Why are my textboxes LightGray?
     
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Hi!
     
    When you use a control inside gallery, you need to bind the value on the record. Otherwise, you refer to a control with all the same name and not relate to a record at all! You will get weird behaviors as you experiencing.
     
    First, you need to add a new column to your collection inside the app. So, on your gallery 'Items' property:
     
    AddColumns(<galDDUListEditCollection>, isSelected, false)
     
    Then, on the checkbox 'OnCheck' property:
     
    Patch(<galDDUListEditCollection>, ThisItem, { isSelected: true }})
     
    And on the checkbox 'OnUncheck' property:
     
    Patch(<galDDUListEditCollection>, ThisItem, { isSelected: false }})
     
    Now, you should be able to use 'ThisItem.isSelected' instead of using 'chkSelect.IsChecked'. If you want to reset all checkboxes, simply Update/Reset collection with all values 'isSelected' to false.
     
    I hope it helps!
    _______________________________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    You have not provided sufficient information to determine the reason for this behaviour.
     
    When Reset gallery is run doesn't this remove  the data from the gallery? If so, then there aren't any items so no code related to items can execute.
    What are the default colours of the gallery?
    I don't understand how you are initially populating the gallery and where the code is being executed.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,351 Super User 2025 Season 2 on at
     
    I am going to go back to the first post on here, mine and ask you to please answer these questions.
     
    1. I do not know, as of yet, where you even are putting this code?
    As to do what you want, you should be using the Template code property (so the whole row is one color not in a single spot)
     
    2. You didn't answer if after unchecking all, my question was, if you then check it and uncheck it manually does the row then show the correct colors.
    Now this is one essentially a no-matter, because you should not have data
     
    3. You said you are doing a Reset, which is great, but why do have ANY rows in it at all, if you did a reset.
    The answer has to be that you still have it pointing to data and the reset isn't really ... doing what you want.
     
    How many rows of data do you really have?
    when you do a reset, do you also reset the data itself? And by this, I mean, you SHOULD have a hidden piece of code, that either clears the data or does whatever it is going to do and then calls Reset on the gallery. Me.. I dont trust reset. I trust clearing the data manually, but again I have no idea what you are doing or why you even need to do a reset.
     
    You shouldn't need any variables, you don't need any special code, you don't need anything, I just need to understand it fully because the pattern you are doing is incorrect. 
     
    Is the gallery in a container? another gallery? custom Control? 
     
    Anytime i reset a gallery I do this and there is much more too it but this is the internet and 5 seconds :-)
     
    Old School Way 1
    1. I make the gallery invisible
    2. I clear the data
    3. I rebuild the data
    4. I make the gallery visible
     
    Clean Old School and I still do Way 2
    1. Put your data into a temporary collection let's call it _MichaelsADorkoCollection
    2. Populate _MichaelsADorkoCollection
    3. Set your Gallery Items to MichaelsDorkoCollection (no _)
    4. Do a ClearCollect(MichaelsDorkoCollection, SortbyColumns(_MichaelsADorkoCollection,"column", SortOrder.Ascending)
    this way all the sorting and data creation happens BEFORE it hits the collection that is being shown
     
    You know what happens now? The entire View of the Gallery is Batch updated and no Gliches... Not Blips, JUST fast instantaneous data.
    And keep doing that with filters you add to the scree, do NOT add filters etc to your items, do it to your OnSelects etc then ClearCollect away and same-o
     
     
    Now unless you are literally loading 1000000000000000 rows (which you cant) lol it will be clean every single time. because galleries for the longest time did not have a way to really reset them and they didn't have a Reset property so that option was out. So many times people would change the data and go OMG there is no data in my gallery.
    And I would say sure there is... you have 15 rows see.. you just can't see them... bug yes. annoying yes., how to get around it was what I said to thousands of employes at Microsoft and outside.
     
    Its time to go back to basics on this as its taking too long to help on a simple issue :-) and if you dont have it fixed I am pretty sure you are tired lol of it too
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard