Version

ColumnAutoSizeMode Property

Specifies column autosizing mode. If AllowColSizing is set to None, then this is ignored.
Syntax
'Declaration
 
Public Property ColumnAutoSizeMode As ColumnAutoSizeMode
public ColumnAutoSizeMode ColumnAutoSizeMode {get; set;}
Remarks

When set the None, the user is not allowed to auto resize a column. If set to VisibleRows, then the column is resized based on the data in the visible rows. If set to SiblingRowsOnly, then the column is autoresized based on data in all the sibling rows. If set to AllRowsInBand, then the column is auto resized based on data in all rows in the band.

Note that this property determines if and how columns are auto-resized when the user auto-resizes one through the user interface by double-clicking on the right edge of the column header. It does not affect how the UltraGridColumn.PerformAutoResize method works. When calling that method, you will need to explicitly specify the ColumnAutoSizeMode parameter.

Example
Following code sets auto-size mode at various levels in the grid.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        ' Set the auto-size mode to AllRowsInBand for the whole grid.
        e.Layout.Override.ColumnAutoSizeMode = ColumnAutoSizeMode.AllRowsInBand

        ' Override the setting on band 1.
        e.Layout.Bands(1).Override.ColumnAutoSizeMode = ColumnAutoSizeMode.SiblingRowsOnly

        ' Override the setting for a column.
        e.Layout.Bands(0).Columns(0).AutoSizeMode = ColumnAutoSizeMode.None
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// Set the auto-size mode to AllRowsInBand for the whole grid.
			e.Layout.Override.ColumnAutoSizeMode = ColumnAutoSizeMode.AllRowsInBand;

			// Override the setting on band 1.
			e.Layout.Bands[1].Override.ColumnAutoSizeMode = ColumnAutoSizeMode.SiblingRowsOnly;

			// Override the setting for a column.
			e.Layout.Bands[0].Columns[0].AutoSizeMode = ColumnAutoSizeMode.None;
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also