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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Referring to Main Gall...
Power Apps
Answered

Referring to Main Gallery IsSelected from SubGallery

(0) ShareShare
ReportReport
Posted on by 72

My first Power App, so sorry for the basic question. 

I have a rectangle in my gallery that changes color to indicate the selected item and the text color is also changed.

 

shpSelectedPerson fill = If(ThisItem.IsSelected, gvAppColor, Transparent)

main gallery all labels color = If(ThisItem.IsSelected, White, Black)

 

I added a subgallery and I want the text to also change color based on the main gallery IsSelected.  However, using "ThisItem.IsSelected" in the subgallery color property only changes the color for the first item in the subgallery.  (i.e. the selected item in the subgallery)

 

Doesn't work:

sub gallery all labels color =If(ThisItem.IsSelected, White, Black)

 

What should I change the ThisItem.IsSelected to in order to refer to the main gallery IsSelected?

 

Or is there another way to achieve this?

 

Thanks,

J

Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Share picture. It is not clear what you want to achieve

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @BPNJMC1 

    Consider not changing the color at all except to make your SubGallery transparent.  This way the underlying colors of the parent gallery will be the color of the subgallery.

    If you have some other concept in mind in regard to colors that would not fit the transparency suggestion, then the trick is that you need to pass the IsSelected to the subgallery as part of the Items property.

    The other option is to utilize a snapshot variable in the parent gallery.  When the user selects a row in the parent, you can set it to some value that is accessible within the Items context of the subgallery.

     

    I know if you are new to PowerApps, what I have mentioned above might go right over your head.  So, if that is the case, provide a little more context on the Items property of your Parent and Sub Galleries.

     

    I hope this is helpful for you.

  • Verified answer
    BPNJMC1 Profile Picture
    72 on at

    @RandyHayes 

    Yes, passing the IsSelected to the subgallery as part of the items property - is over my head 🙂

    But a light bulb went on when I read what you wrote.  I already have the selected PersonKey saved in a global variable so that it can be used in other screens, so this worked:  

    sub gallery all labels color = If(ThisItem.PersonKey = gvSelectedPersonKey, White, Black)

     

    Thank you so much!

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard