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

Enables row-layout functionality in the band.

Syntax

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

Example

The following code demonstrates setting up a simple RowLayout with nested groups by using the RowLayoutStyle of the UltraGridBand and the ParentGroup property on the RowLayoutColumnInfo / RowLayoutGroupInfo or a column / group.

Visual BasicCopy Code
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout

        ' Store the layout and root band in member variables for easy reference.
        Dim layout As UltraGridLayout = e.Layout
        Dim rootBand As UltraGridBand = layout.Bands(0)

        ' Set the RowLayoutStyle to allow groups in RowLayout mode. 
        rootBand.RowLayoutStyle = RowLayoutStyle.GroupLayout

        ' Add a couple of groups.
        Dim group1 As UltraGridGroup = rootBand.Groups.Add("Group 1")
        Dim group2 As UltraGridGroup = rootBand.Groups.Add("Group 2")

        ' Add some sub-groups which will be nested in the main groups. 
        Dim subGroup1A As UltraGridGroup = rootBand.Groups.Add("Sub-Group 1A")
        Dim subGroup1B As UltraGridGroup = rootBand.Groups.Add("Sub-Group 1B")
        Dim subGroup2A As UltraGridGroup = rootBand.Groups.Add("Sub-Group 2A")
        Dim subGroup2B As UltraGridGroup = rootBand.Groups.Add("Sub-Group 2B")

        ' Assign each sub-group to a parent group
        subGroup1A.RowLayoutGroupInfo.ParentGroup = group1
        subGroup1B.RowLayoutGroupInfo.ParentGroup = group1
        subGroup2A.RowLayoutGroupInfo.ParentGroup = group2
        subGroup2B.RowLayoutGroupInfo.ParentGroup = group2

        ' Assign each column to a group. 
        rootBand.Columns("Column 0").RowLayoutColumnInfo.ParentGroup = subGroup1A
        rootBand.Columns("Column 1").RowLayoutColumnInfo.ParentGroup = subGroup1A
        rootBand.Columns("Column 2").RowLayoutColumnInfo.ParentGroup = subGroup1B
        rootBand.Columns("Column 3").RowLayoutColumnInfo.ParentGroup = subGroup1B
        rootBand.Columns("Column 4").RowLayoutColumnInfo.ParentGroup = subGroup2A
        rootBand.Columns("Column 5").RowLayoutColumnInfo.ParentGroup = subGroup2A
        rootBand.Columns("Column 6").RowLayoutColumnInfo.ParentGroup = subGroup2B
        rootBand.Columns("Column 7").RowLayoutColumnInfo.ParentGroup = subGroup2B

    End Sub
C#Copy Code
using Infragistics.Win.UltraWinGrid;


        private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            // Store the layout and root band in member variables for easy reference.
            UltraGridLayout layout = e.Layout;
            UltraGridBand rootBand = layout.Bands[0];

            // Set the RowLayoutStyle to allow groups in RowLayout mode. 
            rootBand.RowLayoutStyle = RowLayoutStyle.GroupLayout;

            // Add a couple of groups.
            UltraGridGroup group1 = rootBand.Groups.Add("Group 1");
            UltraGridGroup group2 = rootBand.Groups.Add("Group 2");

            // Add some sub-groups which will be nested in the main groups. 
            UltraGridGroup subGroup1A = rootBand.Groups.Add("Sub-Group 1A");
            UltraGridGroup subGroup1B = rootBand.Groups.Add("Sub-Group 1B");
            UltraGridGroup subGroup2A = rootBand.Groups.Add("Sub-Group 2A");
            UltraGridGroup subGroup2B = rootBand.Groups.Add("Sub-Group 2B");

            // Assign each sub-group to a parent group
            subGroup1A.RowLayoutGroupInfo.ParentGroup = group1;
            subGroup1B.RowLayoutGroupInfo.ParentGroup = group1;
            subGroup2A.RowLayoutGroupInfo.ParentGroup = group2;
            subGroup2B.RowLayoutGroupInfo.ParentGroup = group2;

            // Assign each column to a group. 
            rootBand.Columns["Column 0"].RowLayoutColumnInfo.ParentGroup = subGroup1A;
            rootBand.Columns["Column 1"].RowLayoutColumnInfo.ParentGroup = subGroup1A;
            rootBand.Columns["Column 2"].RowLayoutColumnInfo.ParentGroup = subGroup1B;
            rootBand.Columns["Column 3"].RowLayoutColumnInfo.ParentGroup = subGroup1B;
            rootBand.Columns["Column 4"].RowLayoutColumnInfo.ParentGroup = subGroup2A;
            rootBand.Columns["Column 5"].RowLayoutColumnInfo.ParentGroup = subGroup2A;
            rootBand.Columns["Column 6"].RowLayoutColumnInfo.ParentGroup = subGroup2B;
            rootBand.Columns["Column 7"].RowLayoutColumnInfo.ParentGroup = subGroup2B;
        }

Remarks

This property is a replacement for (now obsolete) UseRowLayout property.

The RowLayoutStyle.None setting is the equivalent of setting UseRowLayout to false. In this style, the columns are arranged based on Groups, Levels, and the VisiblePosition on the column header.

The RowLayoutStyle.ColumnLayout setting is the equivalent of setting UseRowLayout to true. In this style, the columns are arranged using a GridBagLayout. Use Infragistics.Win.UltraWinGrid.UltraGridColumn.RowLayoutColumnInfo object to customize the cell positions. By default all the columns are visible. Set Infragistics.Win.UltraWinGrid.UltraGridColumn.Hidden to true on columns that you want to hide. Groups are ignored in this style.

The RowLayoutStyle.GroupLayout setting is similar to the ColumnLayout, except that groups are included in the layout. Essentially, the RowLayoutColumnInfo of the band will contain groups and each group will contain it's own GridBagLayout. The RowLayoutColumnInfo of each column is considered to apply to the layout of that column's parent object - either the row itself or the ParentGroup if specified. This allows nested layouts within a row so that group headers can be applied to an indefinite number of levels of depth.

Column swapping is disabled in the ColumnLayout or GroupLayout style.

See Also