Table of Contents

Struct RelativeRect

Namespace
Avalonia
Assembly
Avalonia.Base.dll

Defines a rectangle that may be defined relative to a containing element.

public readonly struct RelativeRect : IEquatable<RelativeRect>
Implements
Inherited Members

Constructors

RelativeRect(Point, Point, RelativeUnit)

Initializes a new instance of the RelativeRect structure.

public RelativeRect(Point topLeft, Point bottomRight, RelativeUnit unit)

Parameters

topLeft Point

The top left position of the rectangle.

bottomRight Point

The bottom right position of the rectangle.

unit RelativeUnit

The unit of the rect.

RelativeRect(Point, Size, RelativeUnit)

Initializes a new instance of the RelativeRect structure.

public RelativeRect(Point position, Size size, RelativeUnit unit)

Parameters

position Point

The position of the rectangle.

size Size

The size of the rectangle.

unit RelativeUnit

The unit of the rect.

RelativeRect(Rect, RelativeUnit)

Initializes a new instance of the RelativeRect structure.

public RelativeRect(Rect rect, RelativeUnit unit)

Parameters

rect Rect

The rectangle.

unit RelativeUnit

The unit of the rect.

RelativeRect(Size, RelativeUnit)

Initializes a new instance of the RelativeRect structure.

public RelativeRect(Size size, RelativeUnit unit)

Parameters

size Size

The size of the rectangle.

unit RelativeUnit

The unit of the rect.

RelativeRect(double, double, double, double, RelativeUnit)

Initializes a new instance of the RelativeRect structure.

public RelativeRect(double x, double y, double width, double height, RelativeUnit unit)

Parameters

x double

The X position.

y double

The Y position.

width double

The width.

height double

The height.

unit RelativeUnit

The unit of the rect.

Fields

Fill

A rectangle that represents 100% of an area.

public static readonly RelativeRect Fill

Field Value

RelativeRect

Properties

Rect

Gets the rectangle.

public Rect Rect { get; }

Property Value

Rect

Unit

Gets the unit of the rectangle.

public RelativeUnit Unit { get; }

Property Value

RelativeUnit

Methods

Equals(RelativeRect)

Checks if the RelativeRect equals another rectangle.

public bool Equals(RelativeRect p)

Parameters

p RelativeRect

The other rectangle.

Returns

bool

True if the objects are equal, otherwise false.

Equals(object?)

Checks if the RelativeRect equals another object.

public override bool Equals(object? obj)

Parameters

obj object

The other object.

Returns

bool

True if the objects are equal, otherwise false.

GetHashCode()

Gets a hashcode for a RelativeRect.

public override int GetHashCode()

Returns

int

A hash code.

Parse(string)

Parses a RelativeRect string.

public static RelativeRect Parse(string s)

Parameters

s string

The string.

Returns

RelativeRect

The parsed RelativeRect.

ToPixels(Rect)

Converts a RelativeRect into pixels.

public Rect ToPixels(Rect boundingBox)

Parameters

boundingBox Rect

The bounding box of the visual.

Returns

Rect

The origin point in pixels.

ToPixels(Size)

Converts a RelativeRect into pixels.

public Rect ToPixels(Size size)

Parameters

size Size

The size of the visual.

Returns

Rect

The origin point in pixels.

Operators

operator ==(RelativeRect, RelativeRect)

Checks for equality between two RelativeRects.

public static bool operator ==(RelativeRect left, RelativeRect right)

Parameters

left RelativeRect

The first rectangle.

right RelativeRect

The second rectangle.

Returns

bool

True if the rectangles are equal; otherwise false.

operator !=(RelativeRect, RelativeRect)

Checks for inequality between two RelativeRects.

public static bool operator !=(RelativeRect left, RelativeRect right)

Parameters

left RelativeRect

The first rectangle.

right RelativeRect

The second rectangle.

Returns

bool

True if the rectangles are unequal; otherwise false.