Showing results for 
Search instead for 
Did you mean: 
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?





Helper II
Helper II

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.

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

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (6,940)