Version

LabelPosition Property

Indicates if and how the label (column header) is be shown in relation to the cell.
Syntax
'Declaration
 
Public Property LabelPosition As LabelPosition
public LabelPosition LabelPosition {get; set;}
Remarks

There are two row-layout modes concerning column label positioning. Column labels can be displayed with the cells inside of each row or in a separate area. This any setting of this property is honored when the column labels are displayed with the cells however only the None and LabelOnly are honored when the labels are in separate area. By default, the column labels are not displayed with the cells.

When column labels are displayed with cells, they are repeated in every row while in the other mode, they are displayed in a separate area. In card-view, that separate area is the card-label area left of the rows and in non-card-view, it is the header area above the rows. In card-view, setting UltraGridCardSettings.Style to a value other than MergedLabels displays the column labels with the cells. In non-card view setting the UltraGridBand.RowLayoutLabelStyle to WithCellData displays the column labels with the cells.

Example
Following code demonstrates some of the properties avaibale on RowLayoutColumnInfo object.

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
        ' Create a data table with 3 columns.
        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))

        ' Fill the data table with some random data.
        Dim random As Random = New Random()
        Dim i As Integer
        For i = 0 To 100 - 1
            dt.Rows.Add(New String() {"Test" & i + 1, "Test" & i + 2, "Test" & i + 3})
        Next

        ' Set the grid's data source to the data table.
        Me.UltraGrid1.DataSource = dt

        Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands("Table1")

        ' Get the columns of Table1 band in the UltraGrid.
        Dim gridColumns As ColumnsCollection = band.Columns

        ' Turn on the row layout functionality for Table1 band.
        band.RowLayoutStyle = RowLayoutStyle.ColumnLayout

        ' Set the RowLayoutLabelStyle to WithCellData so the column labels appear
        ' in the row-cell area with cells instead of a seperate area on the top.
        band.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData

        ' Set the RowLayoutLabelPosition to Left so all the cell labels are left
        ' to the cells. LabelPosition can be set on individual columns as well
        ' like we do below to override this default for that column.
        band.RowLayoutLabelPosition = LabelPosition.Left

        ' Setup Col1 column.
        ' --------------------------------------
        gridColumns("Col1").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col1").RowLayoutColumnInfo.OriginY = 0
        ' Allocate 1 horizontal span for the label. Horizontal because the 
        ' RowLayoutLabelPosition is set to Left for the band.
        gridColumns("Col1").RowLayoutColumnInfo.LabelSpan = 1
        ' Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
        gridColumns("Col1").RowLayoutColumnInfo.SpanX = 2
        ' Set the SpanY to 1.
        gridColumns("Col1").RowLayoutColumnInfo.SpanY = 1

        ' Optionally set the minimum and preferred sizes for the cell labels and
        ' the cells associated with Col1.
        gridColumns("Col1").RowLayoutColumnInfo.MinimumCellSize = New Size(50, 20)
        gridColumns("Col1").RowLayoutColumnInfo.MinimumLabelSize = New Size(50, 20)
        gridColumns("Col1").RowLayoutColumnInfo.PreferredCellSize = New Size(100, 20)
        gridColumns("Col1").RowLayoutColumnInfo.PreferredLabelSize = New Size(80, 20)

        ' Allow the user to only resize the label and the cell horizontally and not
        ' vertically.
        gridColumns("Col2").RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal
        gridColumns("Col2").RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal
        ' --------------------------------------

        ' --------------------------------------
        ' Setup Col2 column.
        ' OriginX of the Col2 is 2 because the Col1 occupies the first 2 logical
        ' columns.
        gridColumns("Col2").RowLayoutColumnInfo.OriginX = 2
        gridColumns("Col2").RowLayoutColumnInfo.OriginY = 0
        ' Allocate 1 horizontal span for the label. Horizontal because the 
        ' RowLayoutLabelPosition is set to Left for the band.
        gridColumns("Col2").RowLayoutColumnInfo.LabelSpan = 1
        ' Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
        gridColumns("Col2").RowLayoutColumnInfo.SpanX = 2
        ' Set the SpanY to 1.
        gridColumns("Col2").RowLayoutColumnInfo.SpanY = 1

        ' Optionally set the minimum and preferred sizes for the cell labels and
        ' the cells associated with Col2.
        gridColumns("Col2").RowLayoutColumnInfo.MinimumCellSize = New Size(50, 20)
        gridColumns("Col2").RowLayoutColumnInfo.MinimumLabelSize = New Size(50, 20)
        gridColumns("Col2").RowLayoutColumnInfo.PreferredCellSize = New Size(100, 20)
        gridColumns("Col2").RowLayoutColumnInfo.PreferredLabelSize = New Size(80, 20)

        ' Allow the user to only resize the label and the cell horizontally and not
        ' vertically.
        gridColumns("Col2").RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal
        gridColumns("Col2").RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal
        ' --------------------------------------

        ' --------------------------------------
        ' Setup Col3 column.
        ' Set the OriginX to 0 and OriginY to 1. OriginY of Col1 and Col2 were
        ' set to 0 and their SpanY were 1. In order for Col3 to be below those
        ' columns, OriginY needs to be set to 1.
        gridColumns("Col3").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col3").RowLayoutColumnInfo.OriginY = 1
        ' For Col3 set the LabelPosition to Top so the cell label is above
        ' the cell.
        gridColumns("Col3").RowLayoutColumnInfo.LabelPosition = LabelPosition.Top
        ' Allocate 1 vertical span for the label. Vertical because the 
        ' RowLayoutLabelPosition is set to Top for the column. 
        gridColumns("Col3").RowLayoutColumnInfo.LabelSpan = 1
        ' Set the SpanX to Remainder so that it spans horizontally to occupy
        ' remaning space.
        gridColumns("Col3").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder
        ' Set the SpanY to 2, 1 for the label and 1 for the cell. (LabelPosition
        ' is set to Top so the label is above the cell.
        gridColumns("Col3").RowLayoutColumnInfo.SpanY = 2

        ' Set the preferred cell height of the Col3 to 40 so it's twice as high as
        ' above cells.
        gridColumns("Col3").RowLayoutColumnInfo.PreferredCellSize = New Size(0, 40)
        ' --------------------------------------

        band.Override.RowSpacingAfter = 5
        band.Override.HeaderAppearance.BackColor = Color.LightBlue
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void Form1_Load(object sender, System.EventArgs e)
		{
			// Create a data table with 3 columns.
			DataTable dt = new DataTable( "Table1" );
			dt.Columns.Add( "Col1", typeof( string ) );
			dt.Columns.Add( "Col2", typeof( string ) );
			dt.Columns.Add( "Col3", typeof( string ) );

			// Fill the data table with some random data.
			Random random = new Random( );
			for ( int i = 0; i < 100; i++ )
				dt.Rows.Add( new string[] { "Test" + i + 1, "Test" + i + 2, "Test" + i + 3 } );

			// Set the grid's data source to the data table.
			this.ultraGrid1.DataSource = dt;

			UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands["Table1"];

			// Get the columns of Table1 band in the UltraGrid.
			ColumnsCollection gridColumns = band.Columns;

			// Turn on the row layout functionality for Table1 band.
			band.RowLayoutStyle = RowLayoutStyle.ColumnLayout;

			// Set the RowLayoutLabelStyle to WithCellData so the column labels appear
			// in the row-cell area with cells instead of a seperate area on the top.
			band.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData;

			// Set the RowLayoutLabelPosition to Left so all the cell labels are left
			// to the cells. LabelPosition can be set on individual columns as well
			// like we do below to override this default for that column.
			band.RowLayoutLabelPosition = LabelPosition.Left;

			// Setup Col1 column.
			// --------------------------------------
			gridColumns["Col1"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col1"].RowLayoutColumnInfo.OriginY = 0;
			// Allocate 1 horizontal span for the label. Horizontal because the 
			// RowLayoutLabelPosition is set to Left for the band.
			gridColumns["Col1"].RowLayoutColumnInfo.LabelSpan = 1;
			// Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
			gridColumns["Col1"].RowLayoutColumnInfo.SpanX	= 2; 
			// Set the SpanY to 1.
			gridColumns["Col1"].RowLayoutColumnInfo.SpanY	= 1;

			// Optionally set the minimum and preferred sizes for the cell labels and
			// the cells associated with Col1.
			gridColumns["Col1"].RowLayoutColumnInfo.MinimumCellSize = new Size( 50, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.MinimumLabelSize = new Size( 50, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.PreferredCellSize = new Size( 100, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.PreferredLabelSize = new Size( 80, 20);

			// Allow the user to only resize the label and the cell horizontally and not
			// vertically.
			gridColumns["Col2"].RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal;
			gridColumns["Col2"].RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal;
			// --------------------------------------

			// --------------------------------------
			// Setup Col2 column.
			// OriginX of the Col2 is 2 because the Col1 occupies the first 2 logical
			// columns.
			gridColumns["Col2"].RowLayoutColumnInfo.OriginX = 2;
			gridColumns["Col2"].RowLayoutColumnInfo.OriginY = 0;
			// Allocate 1 horizontal span for the label. Horizontal because the 
			// RowLayoutLabelPosition is set to Left for the band.
			gridColumns["Col2"].RowLayoutColumnInfo.LabelSpan = 1;
			// Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
			gridColumns["Col2"].RowLayoutColumnInfo.SpanX	= 2; 
			// Set the SpanY to 1.
			gridColumns["Col2"].RowLayoutColumnInfo.SpanY	= 1;

			// Optionally set the minimum and preferred sizes for the cell labels and
			// the cells associated with Col2.
			gridColumns["Col2"].RowLayoutColumnInfo.MinimumCellSize = new Size( 50, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.MinimumLabelSize = new Size( 50, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.PreferredCellSize = new Size( 100, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.PreferredLabelSize = new Size( 80, 20);

			// Allow the user to only resize the label and the cell horizontally and not
			// vertically.
			gridColumns["Col2"].RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal;
			gridColumns["Col2"].RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal;
			// --------------------------------------

			// --------------------------------------
			// Setup Col3 column.
			// Set the OriginX to 0 and OriginY to 1. OriginY of Col1 and Col2 were
			// set to 0 and their SpanY were 1. In order for Col3 to be below those
			// columns, OriginY needs to be set to 1.
			gridColumns["Col3"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col3"].RowLayoutColumnInfo.OriginY = 1;
			// For Col3 set the LabelPosition to Top so the cell label is above
			// the cell.
			gridColumns["Col3"].RowLayoutColumnInfo.LabelPosition = LabelPosition.Top;
			// Allocate 1 vertical span for the label. Vertical because the 
			// RowLayoutLabelPosition is set to Top for the column. 
			gridColumns["Col3"].RowLayoutColumnInfo.LabelSpan = 1;
			// Set the SpanX to Remainder so that it spans horizontally to occupy
			// remaning space.
			gridColumns["Col3"].RowLayoutColumnInfo.SpanX	= RowLayoutColumnInfo.Remainder; 
			// Set the SpanY to 2, 1 for the label and 1 for the cell. (LabelPosition
			// is set to Top so the label is above the cell.
			gridColumns["Col3"].RowLayoutColumnInfo.SpanY	= 2;

			// Set the preferred cell height of the Col3 to 40 so it's twice as high as
			// above cells.
			gridColumns["Col3"].RowLayoutColumnInfo.PreferredCellSize = new Size( 0, 40 );
			// --------------------------------------

			band.Override.RowSpacingAfter = 5;
			band.Override.HeaderAppearance.BackColor = Color.LightBlue;
		}
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