DataGridLength Structure
Represents the lengths of elements within the DataGrid control.
Namespace: System.Windows.Controls
Assembly: System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)
'Declaration <TypeConverterAttribute(GetType(DataGridLengthConverter))> _ Public Structure DataGridLength _ Implements IEquatable(Of DataGridLength)
<object property="absolutePixelValue"/> - or - <object property="starSizing"/> - or - <object property="Auto"/> - or - <object property="SizeToCells"/> - or - <object property="SizeToHeader"/>
XAML Values
The DataGridLength type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DataGridLength(Double) | Initializes a new instance of the DataGridLength class. |
![]() | DataGridLength(Double, DataGridLengthUnitType) | Initializes a new instance of the DataGridLength class with the specified value and unit type. |
![]() | DataGridLength(Double, DataGridLengthUnitType, Double, Double) | Initializes a new instance of the DataGridLength class with the specified value, unit type, desired value, and display value. |
| Name | Description | |
|---|---|---|
![]() ![]() | Auto | Gets a DataGridLength structure that represents the standard automatic sizing mode. |
![]() | DesiredValue | The desired value of the DataGridLength if it is not affected by interactions with other DataGrid columns. |
![]() | DisplayValue | Gets the actual value for a DataGridLength, in pixels. |
![]() | IsAbsolute | Gets a value that indicates whether this DataGridLength instance holds an absolute value. |
![]() | IsAuto | Gets a value that indicates whether this DataGridLength instance uses the standard automatic sizing mode. |
![]() | IsSizeToCells | Gets a value that indicates whether this DataGridLength instance uses the cell-based automatic sizing mode. |
![]() | IsSizeToHeader | Gets a value that indicates whether this DataGridLength instance uses the header-based automatic sizing mode. |
![]() | IsStar | Gets a value that indicates whether UnitType property is set to Star, which means space is distributed by weighted proportion |
![]() ![]() | SizeToCells | Gets a DataGridLength structure that represents the cell-based automatic sizing mode. |
![]() ![]() | SizeToHeader | Gets a DataGridLength structure that represents the header-based automatic sizing mode. |
![]() | UnitType | Gets a value that indicates how the size of the associated DataGrid element is calculated. |
![]() | Value | Gets the absolute value of the DataGridLength in pixels. |
| Name | Description | |
|---|---|---|
![]() | Equals(DataGridLength) | Determines whether the specified DataGridLength is equal to the current DataGridLength. |
![]() | Equals(Object) | Determines whether the specified object is equal to the current DataGridLength. (Overrides ValueType.Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Gets a hash code for the DataGridLength. (Overrides ValueType.GetHashCode.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality | Compares two DataGridLength structures for equality. |
![]() ![]() | Inequality | Compares two DataGridLength structures to determine whether they are not equal. |
The DataGridLength type is used by the DataGridColumn.Width and DataGrid.ColumnWidth properties to enable you to specify absolute values or automatic sizing modes.
In Silverlight 4 and later, the star sizing mode can be used to distribute available space by weighted proportions.
In Extensible Application Markup Language (XAML), star sizing values are expressed as n* where n represents a numeric value. 1* is equivalent to *. Any width that uses star sizing divides any remaining width in the DataGrid container. For example if two columns in a DataGrid had widths of * and 2*, the first column would receive one portion of the available space and the second column would receive two portions of the available space. As another example, if a DataGrid had a fixed width of 800, and column widths of 200, * and 2*, the widths of the three columns would be 200, 200, and 400. For more information, see Sizing Options in the DataGrid Control.
DataGridLength structures can be declared as resources in a ResourceDictionary, if you use an initialization text form that invokes the same string type conversion behavior as the attribute form.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




