Imports Infragistics.Win.UltraWinGrid
...
Class CustomMergedCellEvaluator Implements Infragistics.Win.UltraWinGrid.IMergedCellEvaluator
Function ShouldCellsBeMerged(ByVal row1 As UltraGridRow, ByVal row2 As UltraGridRow, ByVal column As UltraGridColumn) As Boolean Implements IMergedCellEvaluator.ShouldCellsBeMerged
Dim date1 As DateTime = DirectCast(row1.GetCellValue(column), DateTime)
Dim date2 As DateTime = DirectCast(row2.GetCellValue(column), DateTime)
' 基本の DateTime セル値の日付部分に基づいてセルをマージします。
' 時刻部分は無視します。たとえば、"1/1/2004 10:30 AM" と
' 1/1/2004 1:15 AM" は日付が同じであるため、両者はマージします。
Return date1.Date = date2.Date
End Function
End Class
Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout
' MergedCellStyle プロパティを設定してマージされたセル機能を有効にします。
' MergedCellStyle は、セルをマージする対象の列も指定します。
e.Layout.Override.MergedCellStyle = MergedCellStyle.Always
' MergedCellEvaluator プロパティを使用して、セルをマージするためのカスタム ロジック
' を指定します。
e.Layout.Bands(0).Columns("ShippedDate").MergedCellEvaluator = New CustomMergedCellEvaluator()
End Sub