'宣言 Public Property ParentGroup As UltraGridGroup
public UltraGridGroup ParentGroup {get; set;}
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
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; }