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 / Formatting a selected ...
Power Apps
Answered

Formatting a selected Gallery item

(0) ShareShare
ReportReport
Posted on by 200

I am trying to reverse-engineer the PDF Viewer sample app. As shown below, selection of a Gallery item makes several visual enhancements visible. Can anyone clue me in on how this is accomplished? I don't see any "OnSelect" formulas, and when I create my own gallery, I don't get these effect.

 

pdf_gallery_select_formatting.JPGpdf_gallery_select_formatting.JPG

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @tom_garvin,

     

    I don't see any PDF viewer sample app on the list.

    Capture.PNG

     

    Would you explain where did you get the sample app?

     

    Regards,

    Mona

  • tom.garvin Profile Picture
    200 on at

    PDF Reader in templates for tablets.

     

    Note that my question is not specific to the PDF sample, rather highlighting of a selected Gallery item.

     

    This is much more important on a larger screen, where the selection list (gallery)

  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    You can use the 'IsSelected' property of the ThisItem operator within the gallery to know when the element is selected.

     

    For example, in the app you mentioned, I imagine the formulas look somewhat like the ones below:

    Gallery1.TemplateFill: If(ThisItem.IsSelected, Color.LightBlue, Color.White)
    TitleLabel.FontWeight: If(ThisItem.IsSelected, FontWeight.Bold, FontWeight.Normal)
    AuthorLabel.FontWeight: If(ThisItem.IsSelected, FontWeight.Bold, FontWeight.Normal)
  • tom.garvin Profile Picture
    200 on at

    Sounds like a clue, but where does this "Gallery1.TemplateFill" formula reside?

     

    I have looked, in vain, at a dozen possible locations.

     

    Please bear in mind, I'm transitioning from 20+ years of writing event-driven VBA code. In that scenario, I respond to the event. 

     

    In this scenario, the formula is lurking somewhere and takes effect, almost like magic, but only if you know the trick.

     

     

  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    If you select the gallery, select the formula bar and you'll see the TemplateFill property there:

    ForumPost001.png

  • Verified answer
    tom.garvin Profile Picture
    200 on at

    Thanks, I see this now.

    My confusion arises because for this particular sample, highlighting of the selected gallery item was handled differently. There are several boxes and rectangles which use the formula shown below.

    It was a "learning experience" for me in tracing this behavior, I would have expected visual properties to be editable on the "Properties" tab, rather than "Advanced".

    But since this is dynamic behavior. "fx" makes sense. But even there, as a newbie, I failed to click "more options" and then scroll down another page or two. 

     

     

    gallery_selected_item_highlights.JPG

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard