共用方式為


DataGridLengthUnitType Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines constants that describe how DataGrid elements, such as columns, are sized.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Enumeration DataGridLengthUnitType
public enum DataGridLengthUnitType
<object property = "enumMemberName"/>

Members

Member name Description
Auto The unit of measure is based on the size of the cells and the column header.
Pixel The unit of measure is expressed in pixels.
SizeToCells The unit of measure is based on the size of the cells.
SizeToHeader The unit of measure is based on the size of the column header.
Star The unit of measure is a weighted proportion of the available space.

Remarks

This enumeration is used with the UnitType property of a DataGridLength type to indicate how elements are sized relative to other elements in a DataGrid. The DataGridLength type is used for sizing properties, such as DataGrid.ColumnWidth.

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 values are expressed as n* where n represents a numeric value. 1* is equivalent to *. 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.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.