バージョン

GroupByComparer プロパティ

グループ行を並べ替えるための、カスタムの比較子を指定するプロパティ。
シンタックス
'宣言
 
Public Property GroupByComparer As IComparer
public IComparer GroupByComparer {get; set;}
解説

このIComparerインスタンスは、この列がグループ列の場合に、この列に関連付けられたグループ行を並べ替えるために使用します。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid


    Private Class CustomGroupByRowsSorter
        Implements IComparer

        Private Function Compare(ByVal xObj As Object, ByVal yObj As Object) As Integer Implements IComparer.Compare
            Dim x As UltraGridGroupByRow = DirectCast(xObj, UltraGridGroupByRow)
            Dim y As UltraGridGroupByRow = DirectCast(yObj, UltraGridGroupByRow)

            ' Compare the group rows by the number of items they contain.
            Return x.Rows.Count.CompareTo(y.Rows.Count)
        End Function

    End Class

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout
        ' Make sure the ViewStyleBand is set to OutlookGroupBy in order to be able
        ' to group rows.
        Me.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy
        Me.ultraGrid1.DisplayLayout.Bands(0).SortedColumns.Clear()

        Dim countryCol As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Country")

        ' Group rows by country column.
        Me.ultraGrid1.DisplayLayout.Bands(0).SortedColumns.Add(countryCol, False, True)

        ' Assign the GroupByComparer to our custom group rows comparer which
        ' we defined above.
        countryCol.GroupByComparer = New CustomGroupByRowsSorter()
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private class CustomGroupByRowsSorter : IComparer
		{
			public int Compare( object xObj, object yObj )
			{
				UltraGridGroupByRow x = (UltraGridGroupByRow)xObj;
				UltraGridGroupByRow y = (UltraGridGroupByRow)yObj;

				// Compare the group rows by the number of items they contain.
				return x.Rows.Count.CompareTo( y.Rows.Count );
			}
		}

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// Make sure the ViewStyleBand is set to OutlookGroupBy in order to be able
			// to group rows.
			this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
			this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear( );
			
			UltraGridColumn countryCol = this.ultraGrid1.DisplayLayout.Bands[0].Columns[ "Country" ];

			// Group rows by country column.
			this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add( countryCol, false, true );

			// Assign the GroupByComparer to our custom group rows comparer which
			// we defined above.
			countryCol.GroupByComparer = new CustomGroupByRowsSorter( );
		}
参照