Share via


DataGridColumn.MaxWidth Property

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

Gets or sets the maximum column width in pixels.

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

Syntax

'Declaration
Public Property MaxWidth As Double
public double MaxWidth { get; set; }
<sdk:dataGridColumn MaxWidth="double"/>

XAML Values

Property Value

Type: System.Double
The maximum column width in pixels. The default is PositiveInfinity.

Exceptions

Exception Condition
ArgumentOutOfRangeException

When setting this property, the specified value is less than 0.

-or-

The specified value is less than the DataGridColumn.MinWidth.

-or-

The specified value is less than the DataGrid.MinColumnWidth and the DataGridColumn.MinWidth is not set.

Remarks

This property overrides the DataGrid.MaxColumnWidth property.

If the DataGridColumn.MinWidth property is set, MaxWidth must be greater than or equal to the MinWidth property value. If the DataGridColumn.MinWidth property is not set, MaxWidth must be greater than or equal to the DataGrid.MinColumnWidth property value.

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.