How to handle screen rotation in a Windows 8 application

I was wondering how can I handle screen rotation for Windows 8 applications using C #? I want to create several xaml files and just change them every time the screen orientation changes. Is it possible?

+4
source share
2 answers

You can use Device Window in Visual Studio to write state changes to interface elements. In the device window, you can select other visual states (namely, click, full-screen portrait, full-screen landscape and filling), and then make the necessary changes for the desired final state. These changes are then written to VisualStateManager in part of your XAML file. The obvious advantage here is that β€œit just works”, you don’t need to detect the orientation state yourself or do any fancy XAML replacements / replacements.

Step 3 of the tutorial on navigation, layout, and views contains an example of this - it is quite simplified, but needs to understand concepts in.

+4
source

Open the AppManifest file in your project and select the desired orientations.

+1
source

Source: https://habr.com/ru/post/1438525/