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.
Upper | Width | If(Parent.Orientation = Layout.Vertical, Parent.Width, Parent.Width / 2) |
Upper | Height | If(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
Solved! Go to Solution.
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
I’m 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, it’s 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.
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
I’m 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, it’s 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.