ColumnDefinition.Width Property

May 11, 2014

Gets the calculated width of a ColumnDefinition element, or sets the GridLength value of a column that is defined by the ColumnDefinition.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public GridLength Width { get; set; }
<ColumnDefinition Width="doubleValue"/>
- or -
<ColumnDefinition Width="starSizing"/>
-or-
<ColumnDefinition Width="Auto"/>

XAML Values

doubleValue

The column's width, expressed as a floating-point value for a logical pixel count. Typically this is specified as an integer, although interpolation of floating-point values is supported by grid layout.

starSizing

A convention by which you can size rows or columns to take the remaining available space in a Grid. A star sizing always includes the asterisk character (*), and optionally precedes the asterisk with an integer value that specifies a weighted factor versus other possible star sizings (for example, 3*). For more information about star sizing, see Grid.

Auto

The column's width, described by the literal Auto. For more information about Auto sizing, see Grid or GridLength.

Property Value

Type: System.Windows.GridLength
The GridLength that represents the width of the column. The default value is 1.0.

Dependency property identifier field: WidthProperty

If a child element is added to a column in a Grid, and the column has its Width property set to Auto, the child will be measured without restrictions. This behavior can prevent horizontal scroll bars from displaying if a ScrollViewer is being used, as the child element is measured as unbounded. For purposes of display, the child is clipped instead of scrolled.

The default GridUnitType is Star.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft