cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to detect when screen size changes

I'm creating a responsive app and would like to be able to use variables in switch statements in formulas. I have all responsive App settings and the layout is Landscape.

 

App.ActiveScreen.Size and .Orientation do not change when you change orientation or the size of the window. I tested using portrait mode and it doesn't change there either.

 

Is there a way I can set a global variable in OnStart and then change it when the App.Width changes? I cannot find a place it will let me put the code because it always says behavioral in non behavioral formula.

 

Surely there has to be some way to trigger an event when the screen size changes?

 

 

 

 

2 REPLIES 2
Highlighted
Helper II
Helper II

Re: How to detect when screen size changes

You can set a variable when a user has the app in portrait or landscape by:

 

If(Parent.Orientation = Layout.Vertical, Set(varTextSize, 23), Set(varTextSize, 40))

 

The formula above, will set a variable for changing the text size, the the app is vertical, and set this to 23, if it's horizontal then set it to 40. 

 

You can put this in OnStart.

Highlighted
Frequent Visitor

Re: How to detect when screen size changes

I tried this and ran into issues.

 

Parent.  doesn't work in OnStart, so I used App.Activescreen.Orientation

The Orientation it returns is whatever you chose in Settings, Landscape or Portrait. The value does not change, even if you start the app in Portrait. If you selected Landscape in settings it comes back as font size 40.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,994)