Back to Devexpress

OnScreenHeightExtension Class

maui-devexpress-dot-maui-dot-core-afd3b326.md

latest3.8 KB
Original Source

OnScreenHeightExtension Class

Implements a XAML extension that allows you to specify control settings depending on the current screen height and screen orientation.

Namespace : DevExpress.Maui.Core

Assembly : DevExpress.Maui.Core.dll

NuGet Package : DevExpress.Maui.Core

Declaration

csharp
public class OnScreenHeightExtension :
    OnScreenSizeExtensionBase

Remarks

You can use the OnScreenHeightExtension to adapt the app layout and control settings when changing screen height. For example, the available screen height changes when you rotate the screen to switch orientation from landscape to portrait or vice versa.

The following example shows how to specify the DXButton‘s height depending on the device screen height:

xaml
<ContentPage ...
             xmlns:dx="clr-namespace:DevExpress.Maui.Core;assembly=DevExpress.Maui.Core">
    <!--...-->
        <dx:DXButton Content="Click"
                           HeightRequest="{dx:OnScreenHeight ExtraSmall='50', Small='75', Medium='100', Large='150', ExtraLarge='200'}"/>
    <!--...-->
</ContentPage>

The table below describes different size classes and their breakpoints in logical (device-independent) pixels:

Size classBreakpoints
ExtraSmallheight < 360
Smallheight ≥ 360
Mediumheight ≥ 375
Largeheight ≥ 428
ExtraLargeheight ≥ 768

The height is calculated as follows: Pixel height / Density.
Refer to the following page for more information: Device display information.

See the following help section for sample devices of each size class: Size Class Classification.

To change the size class breakpoints, use the following properties:

In C# code, you can use the ON.ScreenHeight method to set values depending on the screen height.

Implements

IMarkupExtension\

IMarkupExtension

Inheritance

System.Object DevExpress.Maui.Core.Internal.MarkupExtensionBase
DevExpress.Maui.Core.Internal.DynamicMarkupExtensionBase OnScreenSizeExtensionBase OnScreenHeightExtension

Extension Methods

Yield<OnScreenHeightExtension>()

YieldIfNotNull<OnScreenHeightExtension>()

See Also

OnScreenHeightExtension Members

OnScreenWidthExtension

OnDisplaySizeExtension

Specify Device-Specific Settings

DevExpress.Maui.Core Namespace