Version

Setting the Automatic Resizing Behavior of Cells

Columns are automatically resized when the user clicks on the right-edge of the column’s header. (This is an implementation of a standard Windows behavior.) Auto-resizing is controlled by the ColumnAutoSizeMode property of the Override object, and can be set at the grid level and set or overridden at the band level. With the new options, the available auto-resizing behaviors are:

  • None - Disable auto-resizing.

  • VisibleRows - Perform auto-resizing based on visible rows only.

  • AllRowsInBand - Perform auto-resizing based on all the rows in band.

  • SiblingRowsOnly - Perform auto-resizing based on sibling rows. This option will apply the change in the column size to all the rows in the Rows collection that are siblings of the row whose header was clicked, regardless of visibility.

The default setting is to perform auto-resizing based only on the visible rows. Use the following code to set this property at the grid level.

In Visual Basic:

Imports Infragistics.Win.UltraWinGrid
...
Me.UltraGrid1.DisplayLayout.Override.ColumnAutoSizeMode = ColumnAutoSizeMode.VisibleRows

In C#:

using Infragistics.Win.UltraWinGrid;
...
this.ultraGrid1.DisplayLayout.Override.ColumnAutoSizeMode = ColumnAutoSizeMode.VisibleRows;

Or, you can set the property using the Override for a specific band. The setting will be applied only to rows of that band:

In Visual Basic:

Imports Infragistics.Win.UltraWinGrid
...
Me.UltraGrid1.DisplayLayout.Bands(1).Override.ColumnAutoSizeMode = _
  ColumnAutoSizeMode.AllRowsInBand

In C#:

using Infragistics.Win.UltraWinGrid;
...
this.ultraGrid1.DisplayLayout.Bands[1].Override.ColumnAutoSizeMode =
  ColumnAutoSizeMode.AllRowsInBand;