Rotate Phone Question

I know this has been asked before, but not for a while, so I wondered if there was any update or progress on this issue.

What I want to achieve is to ‘change the layout’ when I rotate my phone… so, for example I might have Scenes or Macros on my Portrait page for a particular room or device, but when I rotate the phone I want a detailed “remote control” type of layout.

This used to be possible using OpenRemote or iRule (I cannot remember which), and it was a great feature.

I tried a number of workarounds to achieve this - the closest i got was thinking I could have a canvas on Stretch across the display and then trigger its Visibility based on its width (knowing that its width would change automaticlaly when I rotate) - BUT this didn’t work, since the Width variable doesnt actually change when the phone rotates… it stays at -2 (NaN).

Has anyone come up with any workaround to be able to know if a phone is in portrait or landscape orientation ?

thanks

You can’t currently change the visibility of something based on rotation. I could probably add a new system variable like “App.Rotation” to a future release which you can use as a trigger on XAML pages.

That would be awesome Bill because I could set properties based on that variable. I would make a whole canvas invisible and another one visible and therefore have a switched layout on rotate.

Sounds good to me.

Thanks.

Yes please!! I second this request :+1::+1:

In today’s 4.3.0.0 release there’s a new system variable App.Orientation you guys can use to trigger changes on your XAML pages. It will either have a value of Portrait or Landscape.

image

Wow this is huge! I can’t wait to use this!!

Oh, very nice @bill. That is going to be a huge feature for mobile device usage…. Bravo!!!

I see it follows the orientation set in the Designer which is great! Is there a way to toggle the orientation without stopping the run-time?

working well on android. One page done… now I gotta rework the rest of my pages.

Not currently. You’ll have to stop & restart the simulator.

@Jdamore i just want to understand your comment above before I have the chance to ‘play’…. Your comment suggests that you can’t dynamically rotate your phone to change the variable? …. Or we’re you just talking about the simulator?

ignore me @Jdamore … i just had a play… it works exactly as I had hoped :slight_smile:

thanks @bill