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

Orientation Property

Hey,

 

I want to build responsive Power Apps and checked out this documentation:

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

 

I am especially interested in Apps for phone and tablet and rearranging the controls when the orientation is changed like it is described at the end of the article (https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout)

It seems there that the "orientation" property would change by rotating the phone and is used as a flag as to which layout should be used.

 

e.g.

UpperWidthIf(Parent.Orientation = Layout.Vertical, Parent.Width, Parent.Width / 2)
UpperHeightIf(Parent.Orientation = Layout.Vertical, Parent.Height / 2, Parent.Height)

 

But here is my problem: althoug the actual orientation of the app changes when I rotate my phone the value of the "orientation" property stays the same (i.e. the formulas above don't change their result).

 

Is there something I am missing? For now I just compare the current height and width:

 

If(App.Height > App.Width; Parent.Width; Parent.Width / 2)

 

But this seems inelegant and not as it is designed to function.

 

Does anybody have an idea?

Philipp

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Orientation Property

Hi @ ORBISChristoph:

Do you want to use Parent.Orientation as a sign to judge the orientation of the device?

Could you tell me whether the app is a Phone layout or a Tablet layout?

Case1: Tablet layout

Im afraid it is not available, because in this case,Orientation is not a dynamic parameter, but a static value.

The value of Orientation is set in Settings(File-Setting-Screen size + orientation-Orientation) ,even if the screen is rotated, its value will not change.

Currently,using App.Height > App.Width seems to be the only solution.

Case2: Phone layout

In this case, the value of Parent.Orientation will change when the user rotate the device.

 

Best Regards,

Bof

View solution in original post

Highlighted
Frequent Visitor

Re: Orientation Property

Excellent!

That would already be enough. 😋

 

But there is still something wrong with your answer: there is actually no difference between phone and tablet form factor. The problem was that I tried to reference the orientation by App.ActiveScreen.Orientation which is fixed on the "DesignOrientation".

 

But the actual current orientation can only be accessed by your way: "Parent.Orientation" which works in Phone as well as in Tablet mode.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Orientation Property

Hi @ ORBISChristoph:

Do you want to use Parent.Orientation as a sign to judge the orientation of the device?

Could you tell me whether the app is a Phone layout or a Tablet layout?

Case1: Tablet layout

Im afraid it is not available, because in this case,Orientation is not a dynamic parameter, but a static value.

The value of Orientation is set in Settings(File-Setting-Screen size + orientation-Orientation) ,even if the screen is rotated, its value will not change.

Currently,using App.Height > App.Width seems to be the only solution.

Case2: Phone layout

In this case, the value of Parent.Orientation will change when the user rotate the device.

 

Best Regards,

Bof

View solution in original post

Highlighted
Frequent Visitor

Re: Orientation Property

Excellent!

That would already be enough. 😋

 

But there is still something wrong with your answer: there is actually no difference between phone and tablet form factor. The problem was that I tried to reference the orientation by App.ActiveScreen.Orientation which is fixed on the "DesignOrientation".

 

But the actual current orientation can only be accessed by your way: "Parent.Orientation" which works in Phone as well as in Tablet mode.

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,454)