The Device.Screen object gives you access to all information and functionality of the screen.
To get the current device's width and height you can use:
var height = View.Root.ActualHeight;
Note: On devices which have a logical buttons bar such as some Windows Phones, the above will give you only the usable size of the device as opposed to the hardware size.
In general you may want your app to be:
The default Zebble project template is configured to support both. But you can also change it to support only portrait or only landscape.
The following shows the configurations necessary for dynamic orientation (supporting both).
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<uap:Rotation Preference="portrait" />
<uap:Rotation Preference="landscape" />
<uap:Rotation Preference="landscapeFlipped" />
</uap:InitialRotationPreference>
If you app supports both portrait and landscape orientation, you can find the current orientation of the device for processing in your app using:
{
// ...
}
else
{
// Landscape logic...
}
{
Device.Screen.OrientationChanged.Handle(OnOrientationChanged);
}
public Task OnOrientationChanged()
{
var newOrientation = Device.Screen.Orientation;
// ...
}