.NET Framework Class Library for Silverlight
ColumnDefinition..::.Width Property

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)
Syntax

Visual Basic (Declaration)
Public Property Width As GridLength
    Get
    Set
Visual Basic (Usage)
Dim instance As ColumnDefinition
Dim value As GridLength

value = instance.Width

instance.Width = value
C#
public GridLength Width { get; set; }
XAML Attribute Usage
<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 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.

Property Value

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

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.

Platforms

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

See Also

Reference

Tags :


Page view tracker