Infragistics(R) NetAdvantage(R) Windows Forms
RowLayoutLabelPosition Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > RowLayout Class : RowLayoutLabelPosition Property

Gets or sets the label position. Label position indicates the position of the column labels in the row layout mode.

Syntax

Visual Basic (Declaration) 
Public Property RowLayoutLabelPosition As LabelPosition
C# 
public LabelPosition RowLayoutLabelPosition {get; set;}

Example

Visual BasicCopy Code
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 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")
        band.Override.RowSpacingAfter = 5
        ' Turn on the row layout functionality for Table1 band.
        band.UseRowLayout = True

        ' Create a new row layout with "RowLayout1" as the key.
        Dim rowLayout1 As RowLayout = band.RowLayouts.Add("RowLayout1")
        ' Setup the columns.
        rowLayout1.ColumnInfos("Col1").Initialize(0, 0, 2, 2)
        rowLayout1.ColumnInfos("Col2").Initialize(2, 0, 2, 2)
        rowLayout1.ColumnInfos("Col3").Initialize(0, 2, 4, 2)
        ' Setup other settings.
        rowLayout1.CardView = False
        ' RowLayoutLabelStyle only applies in regular view (non-card view).
        rowLayout1.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData
        rowLayout1.RowLayoutLabelPosition = LabelPosition.Left


        ' Create a new row layout with "RowLayout2" as the key.
        Dim rowLayout2 As RowLayout = band.RowLayouts.Add("RowLayout2")
        ' Setup the columns.
        rowLayout2.ColumnInfos("Col1").Initialize(0, 0, 2, 2)
        rowLayout2.ColumnInfos("Col2").Initialize(0, 2, 2, 2)
        rowLayout2.ColumnInfos("Col3").Initialize(2, 0, 2, 4)
        rowLayout2.ColumnInfos("Col3").LabelPosition = LabelPosition.Top
        ' Setup other settings.
        rowLayout2.CardView = True
        ' CardViewStyle only applies in card-view.
        rowLayout2.CardViewStyle = CardStyle.StandardLabels
        rowLayout2.RowLayoutLabelPosition = LabelPosition.Left

        ' Load the RowLayout2 row-layout.
        band.RowLayouts("RowLayout2").Apply()
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
        If Me.CheckBox1.Checked Then
            Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("RowLayout1").Apply()
        Else
            Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("RowLayout2").Apply()
        End If
    End Sub
C#Copy Code
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.
			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"];
			band.Override.RowSpacingAfter = 5;
			// Turn on the row layout functionality for Table1 band.
			band.UseRowLayout = true;

			// Create a new row layout with "RowLayout1" as the key.
			RowLayout rowLayout1 = band.RowLayouts.Add("RowLayout1");						
			// Setup the columns.
			rowLayout1.ColumnInfos["Col1"].Initialize( 0, 0, 2, 2 );
			rowLayout1.ColumnInfos["Col2"].Initialize( 2, 0, 2, 2 );
			rowLayout1.ColumnInfos["Col3"].Initialize( 0, 2, 4, 2 );
			// Setup other settings.
			rowLayout1.CardView = false;
			// RowLayoutLabelStyle only applies in regular view (non-card view).
			rowLayout1.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData;
			rowLayout1.RowLayoutLabelPosition = LabelPosition.Left;

			
			// Create a new row layout with "RowLayout2" as the key.
			RowLayout rowLayout2 = band.RowLayouts.Add("RowLayout2");
			// Setup the columns.
			rowLayout2.ColumnInfos["Col1"].Initialize( 0, 0, 2, 2 );
			rowLayout2.ColumnInfos["Col2"].Initialize( 0, 2, 2, 2 );
			rowLayout2.ColumnInfos["Col3"].Initialize( 2, 0, 2, 4 );
			rowLayout2.ColumnInfos["Col3"].LabelPosition = LabelPosition.Top;
			// Setup other settings.
			rowLayout2.CardView = true;			
			// CardViewStyle only applies in card-view.
			rowLayout2.CardViewStyle = CardStyle.StandardLabels;
			rowLayout2.RowLayoutLabelPosition = LabelPosition.Left;

			// Load the RowLayout2 row-layout.
			band.RowLayouts["RowLayout2"].Apply( );
		}
		
		private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
		{
			if ( this.checkBox1.Checked )
			{
				this.ultraGrid1.DisplayLayout.Bands[0].RowLayouts["RowLayout1"].Apply( );
			}
			else
			{
				this.ultraGrid1.DisplayLayout.Bands[0].RowLayouts["RowLayout2"].Apply( );
			}
		}

Remarks

Label position indicates where to position the column label in relation to the associated cell in row layout mode.

UltraGridBand.RowLayoutLabelStyle must be set to WithCellData for this to take effect in regular view (non-card view) mode. In card view, Infragistics.Win.UltraWinGrid.UltraGridCardSettings.Style must be set to a value other than MergedLabels.

See Also