Show / Hide Table of Contents

Struct GridLength

Represents the length of elements that explicitly support Star unit types.

Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public struct GridLength

Constructors

| Improve this Doc View Source

GridLength(Double)

Initializes a new instance of the GridLength structure using the specified absolute value in pixels.

Declaration
public GridLength(double pixels)
Parameters
Type Name Description
System.Double pixels

The absolute count of pixels to establish as the value.

| Improve this Doc View Source

GridLength(Double, GridUnitType)

Initializes a new instance of the GridLength structure and specifies what kind of value it holds.

Declaration
public GridLength(double value, GridUnitType type)
Parameters
Type Name Description
System.Double value

The initial value of this instance of GridLength.

GridUnitType type

The GridUnitType held by this instance of GridLength.

Exceptions
Type Condition
System.ArgumentException

value is less than 0 or is not a number.- or -type is not a valid GridUnitType.

Properties

| Improve this Doc View Source

Auto

Gets an instance of GridLength that holds a value whose size is determined by the size properties of the content object.

Declaration
public static readonly GridLength Auto { get; }
Property Value
Type Description
GridLength

A instance of GridLength whose GridUnitType property is set to Auto.

| Improve this Doc View Source

GridUnitType

Gets the associated GridUnitType for the GridLength.

Declaration
public readonly GridUnitType GridUnitType { get; }
Property Value
Type Description
GridUnitType

One of the GridUnitType values. The default is Auto.

| Improve this Doc View Source

IsAbsolute

Gets a value that indicates whether the GridLength holds a value that is expressed in pixels.

Declaration
public readonly bool IsAbsolute { get; }
Property Value
Type Description
System.Boolean

true if the GridUnitType property is Pixel; otherwise, false.

| Improve this Doc View Source

IsAuto

Gets a value that indicates whether the GridLength holds a value whose size is determined by the size properties of the content object.

Declaration
public readonly bool IsAuto { get; }
Property Value
Type Description
System.Boolean

true if the GridUnitType property is Auto; otherwise, false.

| Improve this Doc View Source

IsStar

Gets a value that indicates whether the GridLength holds a value that is expressed as a weighted proportion of available space.

Declaration
public readonly bool IsStar { get; }
Property Value
Type Description
System.Boolean

true if the GridUnitType property is Star; otherwise, false.

| Improve this Doc View Source

Value

Gets a System.Double that represents the value of the GridLength.

Declaration
public readonly double Value { get; }
Property Value
Type Description
System.Double

A System.Double that represents the value of the current instance.

Methods

| Improve this Doc View Source

Clone()

Get a copy of the current instance of GridLength.

Declaration
public GridLength Clone()
Returns
Type Description
GridLength
| Improve this Doc View Source

Equals(Object)

Determines whether the specified object is equal to the current GridLength instance.

Declaration
public override bool Equals(object oCompare)
Parameters
Type Name Description
System.Object oCompare

The object to compare with the current instance.

Returns
Type Description
System.Boolean

true if the specified object has the same value and GridUnitType as the current instance; otherwise, false.

Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

Equals(GridLength)

Determines whether the specified GridLength is equal to the current GridLength.

Declaration
public bool Equals(GridLength gridLength)
Parameters
Type Name Description
GridLength gridLength

The GridLength structure to compare with the current instance.

Returns
Type Description
System.Boolean

true if the specified GridLength has the same value and GridUnitType as the current instance; otherwise, false.

| Improve this Doc View Source

GetHashCode()

Gets a hash code for the GridLength.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code for the GridLength.

Overrides
System.ValueType.GetHashCode()
| Improve this Doc View Source

ToString()

Returns a System.String representation of the GridLength.

Declaration
public override string ToString()
Returns
Type Description
System.String

A System.String representation of the current GridLength structure.

Overrides
System.ValueType.ToString()

Operators

| Improve this Doc View Source

Equality(GridLength, GridLength)

Compares two GridLength structures for equality.

Declaration
public static bool operator ==(GridLength gl1, GridLength gl2)
Parameters
Type Name Description
GridLength gl1

The first instance of GridLength to compare.

GridLength gl2

The second instance of GridLength to compare.

Returns
Type Description
System.Boolean

true if the two instances of GridLength have the same value and GridUnitType; otherwise, false.

| Improve this Doc View Source

Inequality(GridLength, GridLength)

Compares two GridLength structures to determine if they are not equal.

Declaration
public static bool operator !=(GridLength gl1, GridLength gl2)
Parameters
Type Name Description
GridLength gl1

The first instance of GridLength to compare.

GridLength gl2

The second instance of GridLength to compare.

Returns
Type Description
System.Boolean

true if the two instances of GridLength do not have the same value and GridUnitType; otherwise, false.

  • Improve this Doc
  • View Source