Table of Contents

Struct RelativePoint

Namespace
Avalonia
Assembly
Avalonia.Base.dll

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

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

Constructors

RelativePoint(Point, RelativeUnit)

Initializes a new instance of the RelativePoint struct.

public RelativePoint(Point point, RelativeUnit unit)

Parameters

point Point

The point.

unit RelativeUnit

The unit.

RelativePoint(double, double, RelativeUnit)

Initializes a new instance of the RelativePoint struct.

public RelativePoint(double x, double y, RelativeUnit unit)

Parameters

x double

The X point.

y double

The Y point

unit RelativeUnit

The unit.

Fields

BottomRight

A point at the bottom right of the containing element.

public static readonly RelativePoint BottomRight

Field Value

RelativePoint

Center

A point at the center of the containing element.

public static readonly RelativePoint Center

Field Value

RelativePoint

TopLeft

A point at the top left of the containing element.

public static readonly RelativePoint TopLeft

Field Value

RelativePoint

Properties

Point

Gets the point.

public Point Point { get; }

Property Value

Point

Unit

Gets the unit.

public RelativeUnit Unit { get; }

Property Value

RelativeUnit

Methods

Equals(RelativePoint)

Checks if the RelativePoint equals another point.

public bool Equals(RelativePoint p)

Parameters

p RelativePoint

The other point.

Returns

bool

True if the objects are equal, otherwise false.

Equals(object?)

Checks if the RelativePoint 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 RelativePoint.

public override int GetHashCode()

Returns

int

A hash code.

Parse(string)

Parses a RelativePoint string.

public static RelativePoint Parse(string s)

Parameters

s string

The string.

Returns

RelativePoint

The parsed RelativePoint.

ToPixels(Rect)

Converts a RelativePoint into pixels.

public Point ToPixels(Rect rect)

Parameters

rect Rect

The bounding box of the rendering primitive.

Returns

Point

The origin point in pixels.

ToPixels(Size)

Converts a RelativePoint into pixels.

public Point ToPixels(Size size)

Parameters

size Size

The size of the visual.

Returns

Point

The origin point in pixels.

ToString()

Returns a String representing this RelativePoint instance.

public override string ToString()

Returns

string

The string representation.

Operators

operator ==(RelativePoint, RelativePoint)

Checks for equality between two RelativePoints.

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

Parameters

left RelativePoint

The first point.

right RelativePoint

The second point.

Returns

bool

True if the points are equal; otherwise false.

operator !=(RelativePoint, RelativePoint)

Checks for inequality between two RelativePoints.

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

Parameters

left RelativePoint

The first point.

right RelativePoint

The second point.

Returns

bool

True if the points are unequal; otherwise false.