Skip to main content

RelativeRect Struct

Definition

Namespace:Avalonia
Assembly:Avalonia.Base
Package:Avalonia

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

public struct RelativeRect

Inheritance: ValueType -> RelativeRect

Implements: IEquatable<RelativeRect>

Constructors

NameDescription
RelativeRect (5 overloads)Initializes a new instance of the Avalonia.RelativeRect structure.

RelativeRect overloads

RelativeRect Constructor

Initializes a new instance of the Avalonia.RelativeRect structure.

public RelativeRect(Avalonia.Point topLeft, Avalonia.Point bottomRight, Avalonia.RelativeUnit unit)
Parameters

topLeft Avalonia.Point

The top left position of the rectangle.

bottomRight Avalonia.Point

The bottom right position of the rectangle.

unit Avalonia.RelativeUnit

The unit of the rect.

RelativeRect Constructor

Initializes a new instance of the Avalonia.RelativeRect structure.

public RelativeRect(Avalonia.Point position, Avalonia.Size size, Avalonia.RelativeUnit unit)
Parameters

position Avalonia.Point

The position of the rectangle.

size Avalonia.Size

The size of the rectangle.

unit Avalonia.RelativeUnit

The unit of the rect.

RelativeRect Constructor

Initializes a new instance of the Avalonia.RelativeRect structure.

public RelativeRect(Avalonia.Rect rect, Avalonia.RelativeUnit unit)
Parameters

rect Avalonia.Rect

The rectangle.

unit Avalonia.RelativeUnit

The unit of the rect.

RelativeRect Constructor

Initializes a new instance of the Avalonia.RelativeRect structure.

public RelativeRect(Avalonia.Size size, Avalonia.RelativeUnit unit)
Parameters

size Avalonia.Size

The size of the rectangle.

unit Avalonia.RelativeUnit

The unit of the rect.

RelativeRect Constructor

Initializes a new instance of the Avalonia.RelativeRect structure.

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

x double

The X position.

y double

The Y position.

width double

The width.

height double

The height.

unit Avalonia.RelativeUnit

The unit of the rect.

Methods

NameDescription
Equals (2 overloads)Checks if the Avalonia.RelativeRect equals another rectangle.
GetHashCodeGets a hashcode for a Avalonia.RelativeRect.
ParseParses a Avalonia.RelativeRect string.
ToPixels (2 overloads)Converts a Avalonia.RelativeRect into pixels.

Equals overloads

Equals Method

Checks if the Avalonia.RelativeRect equals another rectangle.

public bool Equals(Avalonia.RelativeRect p)
Parameters

p Avalonia.RelativeRect

The other rectangle.

Returns

bool

True if the objects are equal, otherwise false.

Equals Method

Checks if the Avalonia.RelativeRect equals another object.

public bool Equals(object obj)
Parameters

obj object

The other object.

Returns

bool

True if the objects are equal, otherwise false.

GetHashCode Method

Gets a hashcode for a Avalonia.RelativeRect.

public int GetHashCode()

Returns

int

A hash code.

Parse Method

Parses a Avalonia.RelativeRect string.

public Avalonia.RelativeRect Parse(string s)

Parameters

s string

The string.

Returns

Avalonia.RelativeRect

The parsed Avalonia.RelativeRect.

ToPixels overloads

ToPixels Method

Converts a Avalonia.RelativeRect into pixels.

public Avalonia.Rect ToPixels(Avalonia.Rect boundingBox)
Parameters

boundingBox Avalonia.Rect

The bounding box of the visual.

Returns

Avalonia.Rect

The origin point in pixels.

ToPixels Method

Converts a Avalonia.RelativeRect into pixels.

public Avalonia.Rect ToPixels(Avalonia.Size size)
Parameters

size Avalonia.Size

The size of the visual.

Returns

Avalonia.Rect

The origin point in pixels.

Properties

NameDescription
RectGets the rectangle.
UnitGets the unit of the rectangle.

Rect Property

Gets the rectangle.

public Avalonia.Rect Rect { get; set; }

Unit Property

Gets the unit of the rectangle.

public Avalonia.RelativeUnit Unit { get; set; }

Fields

NameDescription
FillA rectangle that represents 100% of an area.

Fill Field

A rectangle that represents 100% of an area.

public Avalonia.RelativeRect Fill