GroupHeadersVisible プロパティは、グループ ヘッダーの表示/非表示を切り替えるときに使用します。グループ ヘッダーを非表示にすると、グループの選択、移動、入れ替えなどのヘッダー関連の機能が使用できなくなる場合があります。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button28_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button28.Click ' Get the band to have the groups in. Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0) Dim group1 As UltraGridGroup = Nothing Dim group2 As UltraGridGroup = Nothing ' Clear existing groups if any. band.Groups.Clear() ' Add two groups with two different keys. First arguement to the Add call is ' the key and the second arguement is the caption of the group. group1 = band.Groups.Add("Group1", "Address Info") group2 = band.Groups.Add("Group2", "Contact Info") ' If you don't want group headers displayed, set this to false. By default ' it's true. band.GroupHeadersVisible = False ' Set the LevelCount to desired number of levels. Level 0 is the first row in ' the group, while level 1 is the second row in the group and so on. Here we ' are going to have 2 levels. band.LevelCount = 2 ' Add ContactName column to the first level (level 0) of group1 with visible ' position of 0 (meaning it will appear first in that level. There is only ' one header in this particular level level anyways.) group1.Columns.Add(band.Columns("ContactName"), 0, 0) ' Add City column to second level (level 1) with visible position of 0. And ' also add the Country column to the same level with the visible position of ' 1 so that it appears after City column. group1.Columns.Add(band.Columns("City"), 0, 1) group1.Columns.Add(band.Columns("Country"), 1, 1) ' Add Fax and Phone columns to group2 on different levels. group2.Columns.Add(band.Columns("Fax"), 0, 0) group2.Columns.Add(band.Columns("Phone"), 0, 1) ' Prevet the users from moving groups and columns by setting AllowGroupMoving ' and AllowColMoving to NotAllowed. band.Override.AllowGroupMoving = AllowGroupMoving.NotAllowed band.Override.AllowColMoving = AllowColMoving.NotAllowed ' One could change the various properties like RowSpacingAfter and ' BorderStyleRow on the Override change the appearance. band.Override.RowSpacingAfter = 5 band.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Raised End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button28_Click(object sender, System.EventArgs e) { // Get the band to have the groups in. UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; UltraGridGroup group1 = null; UltraGridGroup group2 = null; // Clear existing groups if any. band.Groups.Clear( ); // Add two groups with two different keys. First arguement to the Add call is // the key and the second arguement is the caption of the group. group1 = band.Groups.Add( "Group1", "Address Info" ); group2 = band.Groups.Add( "Group2", "Contact Info" ); // If you don't want group headers displayed, set this to false. By default // it's true. band.GroupHeadersVisible = false; // Set the LevelCount to desired number of levels. Level 0 is the first row in // the group, while level 1 is the second row in the group and so on. Here we // are going to have 2 levels. band.LevelCount = 2; // Add ContactName column to the first level (level 0) of group1 with visible // position of 0 (meaning it will appear first in that level. There is only // one header in this particular level level anyways.) group1.Columns.Add( band.Columns["ContactName"], 0, 0 ); // Add City column to second level (level 1) with visible position of 0. And // also add the Country column to the same level with the visible position of // 1 so that it appears after City column. group1.Columns.Add( band.Columns["City"], 0, 1 ); group1.Columns.Add( band.Columns["Country"], 1, 1 ); // Add Fax and Phone columns to group2 on different levels. group2.Columns.Add( band.Columns["Fax"], 0, 0 ); group2.Columns.Add( band.Columns["Phone"], 0, 1 ); // Prevet the users from moving groups and columns by setting AllowGroupMoving // and AllowColMoving to NotAllowed. band.Override.AllowGroupMoving = AllowGroupMoving.NotAllowed; band.Override.AllowColMoving = AllowColMoving.NotAllowed; // One could change the various properties like RowSpacingAfter and // BorderStyleRow on the Override change the appearance. band.Override.RowSpacingAfter = 5; band.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Raised; }