Version

PreferredCellSize Property

Preferred cell size. Default value is Size(0,0) which means it will calculate a reasonable default size.
Syntax
'Declaration
 
Public Property PreferredCellSize As Size
public Size PreferredCellSize {get; set;}
Remarks

If the Width of the PreferredCellSize is set to 0, then the value of UltraGridColumn.Width will be used as the width. If the Height is set to 0, then a reasonable default height will be calculated.

Cells with the same OriginX and SpanX (vertically stacked) with different PreferredCellSize settings will result in all such cells having the max of the widths when displayed. Likewise Cells with the same OriginY and SpanY (horizontally aligned) with different PreferredCellSize settings will result in all such cells having the max of the heights when displayed.

If MinimumCellSize property is set to a size with width greater then 0, then the bigger of the MinimumCellSize width and PreferredCellSize width will be used as the size of the cell. The same applies to height as well.

Example
Following sample code demonstrates the use of Row-Layout functionality in the UltraGrid.

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

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dt As DataTable = New DataTable("Table1")
        dt.Columns.Add("Col1", GetType(String))
        dt.Columns.Add("Col2", GetType(String))
        dt.Columns.Add("Col3", GetType(String))
        dt.Columns.Add("Col4", GetType(String))
        dt.Columns.Add("Col5", GetType(String))

        Dim random As Random = New Random()
        Dim i As Integer
        For i = 0 To 100 - 1
            Dim rowdata(4) As String
            Dim j As Integer
            For j = 0 To 5 - 1
                rowdata(j) = random.Next(1000).ToString()
            Next
            dt.Rows.Add(rowdata)
        Next

        Me.UltraGrid1.DataSource = dt

        ' Get the columns of Table1 band in the UltraGrid.
        Dim gridColumns As ColumnsCollection = Me.UltraGrid1.DisplayLayout.Bands("Table1").Columns

        ' Turn on the row layout functionality for Table1 band.
        Me.UltraGrid1.DisplayLayout.Bands("Table1").RowLayoutStyle = RowLayoutStyle.ColumnLayout

        ' Allow the user to only resize width of the columns/labels.
        Me.UltraGrid1.DisplayLayout.Bands("Table1").Override.AllowRowLayoutCellSizing = RowLayoutSizing.Horizontal
        Me.UltraGrid1.DisplayLayout.Bands("Table1").Override.AllowRowLayoutLabelSizing = RowLayoutSizing.Horizontal

        ' Setup Col1 column.
        gridColumns("Col1").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col1").RowLayoutColumnInfo.OriginY = 0
        gridColumns("Col1").RowLayoutColumnInfo.SpanX = 1
        gridColumns("Col1").RowLayoutColumnInfo.SpanY = 1
        ' Set the preferred cell size to 200,0 so that it's at least 200 pixel wide.
        ' Height of 0 means that the UltraGrid will calculate one based on the font.
        gridColumns("Col1").RowLayoutColumnInfo.PreferredCellSize = New Size(200, 0)
        ' Set the MinimumCellSize to 50,0 to prevent the user from resizing the column
        ' and making it smaller than 50 in width.
        gridColumns("Col1").RowLayoutColumnInfo.MinimumCellSize = New Size(50, 0)

        ' Setup Col2 column.
        gridColumns("Col2").RowLayoutColumnInfo.OriginX = 1
        gridColumns("Col2").RowLayoutColumnInfo.OriginY = 0
        gridColumns("Col2").RowLayoutColumnInfo.SpanX = 1
        gridColumns("Col2").RowLayoutColumnInfo.SpanY = 1

        ' Setup Col3 column.
        gridColumns("Col3").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col3").RowLayoutColumnInfo.OriginY = 1
        gridColumns("Col3").RowLayoutColumnInfo.SpanX = 1
        gridColumns("Col3").RowLayoutColumnInfo.SpanY = 1

        ' Setup Col4 column.
        gridColumns("Col4").RowLayoutColumnInfo.OriginX = 1
        gridColumns("Col4").RowLayoutColumnInfo.OriginY = 1
        gridColumns("Col4").RowLayoutColumnInfo.SpanX = 1
        gridColumns("Col4").RowLayoutColumnInfo.SpanY = 1
        ' Set the preferred cell size to 150,0 so that it's at least 150 pixel wide.
        ' Height of 0 means that the UltraGrid will calculate one based on the font.
        gridColumns("Col4").RowLayoutColumnInfo.PreferredCellSize = New Size(150, 0)
        ' Set the MinimumCellSize to 50,0 to prevent the user from resizing the column
        ' and making it smaller than 50 in width.
        gridColumns("Col4").RowLayoutColumnInfo.MinimumCellSize = New Size(60, 0)

        ' Setup Col5 column.
        gridColumns("Col5").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col5").RowLayoutColumnInfo.OriginY = 2
        ' Set the SpanX to Remainder so that it occupies the rest of the horizontal space.
        gridColumns("Col5").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder
        gridColumns("Col5").RowLayoutColumnInfo.SpanY = 1
        ' Set the preferred cell size height to 40.
        gridColumns("Col5").RowLayoutColumnInfo.PreferredCellSize = New Size(0, 40)
        gridColumns("Col5").CellMultiLine = DefaultableBoolean.True
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void Form1_Load(object sender, System.EventArgs e)
		{
			DataTable dt = new DataTable( "Table1" );
			dt.Columns.Add( "Col1", typeof( string ) );
			dt.Columns.Add( "Col2", typeof( string ) );
			dt.Columns.Add( "Col3", typeof( string ) );
			dt.Columns.Add( "Col4", typeof( string ) );
			dt.Columns.Add( "Col5", typeof( string ) );

			Random random = new Random( );
			for ( int i = 0; i < 100; i++ )
			{
				string[] rowData = new string[ 5 ];
				for ( int j = 0; j < 5; j++ )
					rowData[j] = random.Next( 1000 ).ToString( );
				
				dt.Rows.Add( rowData );
			}

			this.ultraGrid1.DataSource = dt;

			// Get the columns of Table1 band in the UltraGrid.
			ColumnsCollection gridColumns = this.ultraGrid1.DisplayLayout.Bands["Table1"].Columns;

			// Turn on the row layout functionality for Table1 band.
			this.ultraGrid1.DisplayLayout.Bands["Table1"].RowLayoutStyle = RowLayoutStyle.ColumnLayout;

			// Allow the user to only resize width of the columns/labels.
			this.ultraGrid1.DisplayLayout.Bands["Table1"].Override.AllowRowLayoutCellSizing  = RowLayoutSizing.Horizontal;
			this.ultraGrid1.DisplayLayout.Bands["Table1"].Override.AllowRowLayoutLabelSizing = RowLayoutSizing.Horizontal;

			// Setup Col1 column.
			gridColumns["Col1"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col1"].RowLayoutColumnInfo.OriginY = 0;
			gridColumns["Col1"].RowLayoutColumnInfo.SpanX   = 1;
			gridColumns["Col1"].RowLayoutColumnInfo.SpanY   = 1;
			// Set the preferred cell size to 200,0 so that it's at least 200 pixel wide.
			// Height of 0 means that the UltraGrid will calculate one based on the font.
			gridColumns["Col1"].RowLayoutColumnInfo.PreferredCellSize = new Size( 200, 0 );
			// Set the MinimumCellSize to 50,0 to prevent the user from resizing the column
			// and making it smaller than 50 in width.
			gridColumns["Col1"].RowLayoutColumnInfo.MinimumCellSize = new Size( 50, 0 );

			// Setup Col2 column.
			gridColumns["Col2"].RowLayoutColumnInfo.OriginX = 1;
			gridColumns["Col2"].RowLayoutColumnInfo.OriginY = 0;
			gridColumns["Col2"].RowLayoutColumnInfo.SpanX   = 1;
			gridColumns["Col2"].RowLayoutColumnInfo.SpanY   = 1;
		
			// Setup Col3 column.
			gridColumns["Col3"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col3"].RowLayoutColumnInfo.OriginY = 1;
			gridColumns["Col3"].RowLayoutColumnInfo.SpanX   = 1;
			gridColumns["Col3"].RowLayoutColumnInfo.SpanY   = 1;
		
			// Setup Col4 column.
			gridColumns["Col4"].RowLayoutColumnInfo.OriginX = 1;
			gridColumns["Col4"].RowLayoutColumnInfo.OriginY = 1;
			gridColumns["Col4"].RowLayoutColumnInfo.SpanX   = 1;
			gridColumns["Col4"].RowLayoutColumnInfo.SpanY   = 1;
			// Set the preferred cell size to 150,0 so that it's at least 150 pixel wide.
			// Height of 0 means that the UltraGrid will calculate one based on the font.
			gridColumns["Col4"].RowLayoutColumnInfo.PreferredCellSize = new Size( 150, 0 );
			// Set the MinimumCellSize to 50,0 to prevent the user from resizing the column
			// and making it smaller than 50 in width.
			gridColumns["Col4"].RowLayoutColumnInfo.MinimumCellSize = new Size( 60, 0 );
		
			// Setup Col5 column.
			gridColumns["Col5"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col5"].RowLayoutColumnInfo.OriginY = 2;
			// Set the SpanX to Remainder so that it occupies the rest of the horizontal space.
			gridColumns["Col5"].RowLayoutColumnInfo.SpanX   = RowLayoutColumnInfo.Remainder;
			gridColumns["Col5"].RowLayoutColumnInfo.SpanY   = 1;
			// Set the preferred cell size height to 40.
			gridColumns["Col5"].RowLayoutColumnInfo.PreferredCellSize = new Size( 0, 40);
			gridColumns["Col5"].CellMultiLine = DefaultableBoolean.True;
		}
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