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 / Using Parent.Size for ...
Power Apps
Answered

Using Parent.Size for responsive font size within gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,


I am successfully using Parent.Size on several objects to change the font size depending on the screen size, as shown here: 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout

Parent.Width * 
 Switch(Parent.Size, 
 ScreenSize.Small, 0.5, 
 ScreenSize.Medium, 0.3, 
 0.25)

 I am now trying to achieve the same thing within a gallery, when the screen size is set to ScreenSize.ExtraLarge update the font size to something a bit bigger.

The problem I run into is now I am in a gallery Parent is something else so Parent.Size no longer works. I've looked under App. and Screen. for something similar but can't find what I want.

 

How can I get around this?

Thanks in advance

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    You can get to that with App.ActiveScreen.Size

    App.ActiveScreen.Width * 
     Switch(App.ActiveScreen.Size, 
     ScreenSize.Small, 0.5, 
     ScreenSize.Medium, 0.3, 
     0.25)

    I hope this is helpful for you.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

     Thanks for the quick reply.

     

    I've tried App.ActiveScreen.Size in a label so can confirm it works and updates at the same time as Parent.Size however the font sizes in my gallery don't seem to be changing while using it.

     

    I'm using a slightly different formula to the example however this is working outside the gallery. Maybe it is to do with the gallery?

    Switch(
     App.ActiveScreen.Size,
     ScreenSize.ExtraLarge,
     14,
     11)

     

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

    @Anonymous 

    It shouldn't be an issue.  That value would be the same in or out of a Gallery.

    If you want to confirm this, put a label in your Gallery and set its text to App.ActiveScreen.Size and see if it responds as you expect.

    If so, then I would review your font size formulas again and I would assume you also would be resizing the entire Gallery based on the screen size?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have tried putting a label in my gallery and set it's text to App.ActiveScreen.Size and the label doesn't update when I resize the screen. (A label outside the gallery is updating as expected).

     

    Any other ideas? 🤔

     

    Yeah, the whole gallery is set to resize based on the screen size. This bit responds as expected.

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

    @Anonymous 

    Hmmm, I would not have expected that!  

    Well, in that case - use the label!

    If the label outside of the Gallery responds properly, then just reference that.

    ex.  lblSize text property : App.ActiveScreen.Size

    in the Gallery - Value(lblSize.Text)

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I think the issue is actually with App.ActiveScreen.Size.

     

    When I tested it in a label outside of the gallery it was actually part of a bigger label I was using:

    "Height: " & App.Height & " Width: " & App.Width & " ParentSize: " & Parent.Size & " ActiveScreenSize: " & App.ActiveScreen.Size

    I think having other properties updating allowed App.ActiveScreen.Size to update.


    I just tried to create a label for App.ActiveScreen.Size on it's own (Outside of the gallery) to try your suggestion and it didn't update when I resized the screen. (which would be why it didn't work in the gallery!)

     

    If instead I create a label outside the gallery with Parent.Size I can reference this within the gallery just fine and it updates OK.

     

    Not sure if that was by design or a bug somewhere!

     

    Thanks for all your help!

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

    @Anonymous 

    Yep, that was where I was going next...just use Parent.Size in the outer label.  

    Glad you got to it.

  • kamilo302 Profile Picture
    57 on at

    Thank You!!

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard