cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ORBISChristoph
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
v-bofeng-msft
Community Support
Community Support

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

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
v-bofeng-msft
Community Support
Community Support

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

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,156)