Version

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

Set Column’s Maximum and Minimum Widths

You can set a maximum and minimum width on a column to restrict your end user from resizing a column past a certain threshold. The resized column cannot exceed the column’s maximum width or be less than the column’s minimum width.

To set the minimum and maximum width of a column, you can set the Column object’s MinimumWidth and MaximumWidth properties, as demonstrated in the following code snippet.

In XAML:

<ig:XamGrid x:Name="MyGrid" AutoGenerateColumns="False">
   <ig:XamGrid.ColumnResizingSettings>
      <ig:ColumnResizingSettings AllowColumnResizing="Indicator" />
   </ig:XamGrid.ColumnResizingSettings>
   <ig:XamGrid.Columns>
      <ig:TextColumn Key="ProductID"/>
      <ig:TextColumn Key="ProductName" IsResizable="/>
      <ig:TextColumn Key="QuantityPerUnit" MinimumWidth="10" MaximumWidth="175" />
      ...
   </ig:XamGrid.Columns>
</ig:XamGrid>

In Visual Basic:

Imports Infragistics.Controls.Grids
...
Dim ColumnWidth As Column = Me.MyGrid.Columns.DataColumns("QuantityPerUnit")
ColumnWidth.MaximumWidth = 175
ColumnWidth.MinimumWidth = 10

In C#:

using Infragistics.Controls.Grids;
...
Column ColumnWidth = this.MyGrid.Columns.DataColumns["QuantityPerUnit"];
ColumnWidth.MaximumWidth = 175;
ColumnWidth.MinimumWidth = 10;