Table of Contents

Struct GridLength

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

Holds the width or height of a Grid's column and row definitions.

public struct GridLength : IEquatable<GridLength>
Implements
Inherited Members

Constructors

GridLength(double)

Initializes a new instance of the GridLength struct.

public GridLength(double value)

Parameters

value double

The size of the GridLength in device independent pixels.

GridLength(double, GridUnitType)

Initializes a new instance of the GridLength struct.

public GridLength(double value, GridUnitType type)

Parameters

value double

The size of the GridLength.

type GridUnitType

The unit of the GridLength.

Properties

Auto

Gets an instance of GridLength that indicates that a row or column should auto-size to fit its content.

public static GridLength Auto { get; }

Property Value

GridLength

GridUnitType

Gets the unit of the GridLength.

public GridUnitType GridUnitType { get; }

Property Value

GridUnitType

IsAbsolute

Gets a value that indicates whether the GridLength has a GridUnitType of Pixel.

public bool IsAbsolute { get; }

Property Value

bool

IsAuto

Gets a value that indicates whether the GridLength has a GridUnitType of Auto.

public bool IsAuto { get; }

Property Value

bool

IsStar

Gets a value that indicates whether the GridLength has a GridUnitType of Star.

public bool IsStar { get; }

Property Value

bool

Star

Gets an instance of GridLength that indicates that a row or column should fill its content.

public static GridLength Star { get; }

Property Value

GridLength

Value

Gets the length.

public double Value { get; }

Property Value

double

Methods

Equals(GridLength)

Compares two GridLength structures for equality.

public bool Equals(GridLength gridLength)

Parameters

gridLength GridLength

The structure with which to test equality.

Returns

bool

True if the structures are equal, otherwise false.

Equals(object?)

Determines whether the GridLength is equal to the specified object.

public override bool Equals(object? o)

Parameters

o object

The object with which to test equality.

Returns

bool

True if the objects are equal, otherwise false.

GetHashCode()

Gets a hash code for the GridLength.

public override int GetHashCode()

Returns

int

The hash code.

Parse(string)

Parses a string to return a GridLength.

public static GridLength Parse(string s)

Parameters

s string

The string.

Returns

GridLength

The GridLength.

ParseLengths(string)

Parses a string to return a collection of GridLengths.

public static IEnumerable<GridLength> ParseLengths(string s)

Parameters

s string

The string.

Returns

IEnumerable<GridLength>

The GridLength.

ToString()

Gets a string representation of the GridLength.

public override string ToString()

Returns

string

The string representation.

Operators

operator ==(GridLength, GridLength)

Compares two GridLength structures for equality.

public static bool operator ==(GridLength a, GridLength b)

Parameters

a GridLength

The first GridLength.

b GridLength

The second GridLength.

Returns

bool

True if the structures are equal, otherwise false.

operator !=(GridLength, GridLength)

Compares two GridLength structures for inequality.

public static bool operator !=(GridLength gl1, GridLength gl2)

Parameters

gl1 GridLength

The first GridLength.

gl2 GridLength

The first GridLength.

Returns

bool

True if the structures are unequal, otherwise false.