Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

DataGridColumn.Width Property

Gets or sets the column width or an automatic sizing mode.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)
public DataGridLength Width { get; set; }
<sdk:dataGridColumn Width="dataGridLengthValue"/>

XAML Values


Typically, sdk:DataGridTextColumn, sdk:DataGridCheckBoxColumn, or sdk:DataGridTemplateColumn.


A string that specifies a DataGridLength value. This can be an absolute pixel measure, a star sizing, or the constants Auto, SizeToCells, SizeToHeader. For more information, see DataGridLength.

Property Value

Type: System.Windows.Controls.DataGridLength
A structure that represents the column width or an automatic sizing mode. The default is the DataGrid.ColumnWidth property value.

This property overrides the DataGrid.ColumnWidth property.

Version Notes

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

The following code example shows how to set a Width property to the star value.

<sdk:DataGrid x:Name="productDataGrid"  AutoGenerateColumns="False" ItemsSource="{Binding}">
        <sdk:DataGridTextColumn Binding="{Binding ID}" />
        <sdk:DataGridTextColumn Binding="{Binding Name}"/>
        <sdk:DataGridTextColumn Binding="{Binding Description}" Width="*" />
        <sdk:DataGridTextColumn Binding="{Binding Price}"/>


Supported in: 5, 4, 3

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.