Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

How to disable selected items inside gallery ?

I have a gallery which will display the available time in white and  the non-available time in grey. However, I would like to disable all the colors that are grey to prevent the users from selecting that specific time slot. Is this possible ?


In the gallery button, I set the button color to this:


ThisItem.Name in CollectionFakeHours.Name,
RGBA( 77,168,184,100),
RGBA( 187, 187, 187, 100)


However, instead of making the non available colors grey, I would rather have them disabled instead.   


Thanks !


Super User
Super User

Hi @DevMolly100 

You can do that using the DisplayMode property of the button.  Set your condition for it to be either Edit or Disabled. 



Kudo Kingpin
Kudo Kingpin

You cannot disable the items strictly speaking, but you can work around it. (You can't reference ThisItem directly on the Gallery Item Template's DisplayMode)

Without knowing more of your app, it's hard to tell the best way. 

The selected item is probably being referenced by other objects or a Form. 


One way around would be to completely cover your gallery item (inside the item, so it repeats per item) with a blank label, ordered on top, which would NOT have a Select(Parent) action. Make rules on the height and width of this label. On enabled items, the height and width of this label would be 1,1. On disabled items, it would be Parent.TemplateWidth and Parent.TemplateHeight, making it impossible to trigger OnSelect(). 


Or, you can change the Gallery OnSelect populate a variable, a set, or ClearCollect() the selected item into an intermediate collection, and have your other objects or forms look at that instead. Your OnSelect would be conditional, so it only populates if certain conditions are met. 


The first is simpler as you only add 1 object to the gallery item, but the second provides more variables which may end up being more useful/flexible in the long run.

Frequent Visitor

Check out this other thread discussing this same topic. I followed @VijayTailor's suggestion

Grouping the gallery item fields worked great for me. I was able to change gallery items that were updated to DisplayMode.Disabled. I grouped everything in the gallery item and set a conditional statement for its display mode - If('Text' in Table.Column, DisplayMode.Disabled, DisplayMode.Edit). So, if the 'text' from my gallery item appears in the updated column of my separate update table then that gallery item will be disabled. Good luck!

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

Top Solution Authors
Users online (3,387)