Table of Contents

Class Screen

Namespace
Avalonia.Platform
Assembly
Avalonia.Controls.dll

Represents a single display screen.

public class Screen : IEquatable<Screen>
Inheritance
Screen
Implements
Derived
Inherited Members

Constructors

Screen(double, PixelRect, PixelRect, bool)

Initializes a new instance of the Screen class.

[Unstable("This API may be removed in Avalonia 12. If you depend on this API, please open an issue with details of your use-case.")]
public Screen(double scaling, PixelRect bounds, PixelRect workingArea, bool isPrimary)

Parameters

scaling double

The scaling factor applied to the screen by the operating system.

bounds PixelRect

The overall pixel-size of the screen.

workingArea PixelRect

The actual working-area pixel-size of the screen.

isPrimary bool

Whether the screen is the primary one.

Properties

Bounds

Gets the overall pixel-size and position of the screen.

public PixelRect Bounds { get; protected set; }

Property Value

PixelRect

Remarks

This generally is the raw pixel counts in both the X and Y direction.

CurrentOrientation

Gets the current orientation of a screen.

public ScreenOrientation CurrentOrientation { get; protected set; }

Property Value

ScreenOrientation

DisplayName

Gets the device name associated with a display.

public string? DisplayName { get; protected set; }

Property Value

string

IsPrimary

Gets a value indicating whether the screen is the primary one.

public bool IsPrimary { get; protected set; }

Property Value

bool

Scaling

Gets the scaling factor applied to the screen by the operating system.

public double Scaling { get; protected set; }

Property Value

double

Remarks

Multiply this value by 100 to get a percentage. Both X and Y scaling factors are assumed uniform.

WorkingArea

Gets the actual working-area pixel-size of the screen.

public PixelRect WorkingArea { get; protected set; }

Property Value

PixelRect

Remarks

This area may be smaller than Bounds to account for notches and other block-out areas such as taskbars etc.

Methods

Equals(Screen?)

public virtual bool Equals(Screen? other)

Parameters

other Screen

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

TryGetPlatformHandle()

Tries to get the platform handle for the Screen.

public virtual IPlatformHandle? TryGetPlatformHandle()

Returns

IPlatformHandle

An IPlatformHandle describing the screen handle, or null if the handle could not be retrieved.

Operators

operator ==(Screen?, Screen?)

public static bool operator ==(Screen? left, Screen? right)

Parameters

left Screen
right Screen

Returns

bool

operator !=(Screen?, Screen?)

public static bool operator !=(Screen? left, Screen? right)

Parameters

left Screen
right Screen

Returns

bool