Version

AutoSizeMode Property

Specifies column autosizing mode. If UltraGridOverride.AllowColSizing is set to None, then this is ignored.
Syntax
'Declaration
 
Public Property AutoSizeMode As ColumnAutoSizeMode
public ColumnAutoSizeMode AutoSizeMode {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.

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