Compartir a través de


DataGrid.ColumnWidth Property

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

Gets or sets the standard width or automatic sizing mode of columns in the control.

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

Syntax

'Declaration
Public Property ColumnWidth As DataGridLength
public DataGridLength ColumnWidth { get; set; }
<sdk:DataGrid ColumnWidth="dataGridLength"/>

XAML Values

  • dataGridLength
    An absolute value in pixels, a star sizing, or one of the following constant values: Auto, SizeToCells, SizeToHeaders. For more information, see DataGridLength.

Property Value

Type: System.Windows.Controls.DataGridLength
A structure that represents the standard width or automatic sizing mode of columns in the DataGrid. The default is Auto.

Remarks

Dependency property identifier field: ColumnWidthProperty

By default, columns will automatically adjust their width to fit their contents. This property affects the width setting of every column in the control that does not have an explicit Width setting.

Version Notes

Silverlight 3: The star sizing feature and using * in XAML are not available for Silverlight 3.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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