Version

We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. 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;