Skip to main content
ON

OnDisplaySizeExtension Class

Implements a XAML extension that allows you to specify control settings (for example, the font size) depending on the physical screen size, regardless of the screen orientation.

Namespace: DevExpress.Maui.Core

Assembly: DevExpress.Maui.Core.dll

NuGet Package: DevExpress.Maui.Core

Declaration

public class OnDisplaySizeExtension :
    MarkupExtensionBase<object>

Remarks

The following example shows how to select the font size of a DXButton ‘s text depending on the device screen size:

<ContentPage ...
             xmlns:dx="clr-namespace:DevExpress.Maui.Core;assembly=DevExpress.Maui.Core">
    <!--...-->
        <dx:DXButton Content="Click"
                           FontSize="{dx:OnDisplaySize ExtraSmall='10', Small='12', Medium='14', Large='16', ExtraLarge='18'}"/>
    <!--...-->
</ContentPage>

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

Size class Breakpoints
ExtraSmall height < 360, width < 640
Small height ≥ 360, width ≥ 640
Medium height ≥ 375, width ≥ 732
Large height ≥ 428, width ≥ 853
ExtraLarge height ≥ 768, width ≥ 1024

The height is calculated as follows: Pixel height / Density
The width is calculated as follows: Pixel width / 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.DisplaySize method to set values depending on the screen size.

Implements

IMarkupExtension<System.Object>

Inheritance

System.Object
DevExpress.Maui.Core.Internal.MarkupExtensionBase<System.Object>
OnDisplaySizeExtension
See Also