Imports Infragistics.Shared Imports Infragistics.Win 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) ' Merge cells according to the date portions of the underlying DateTime cell ' values, ignoring any time portion. For example, "1/1/2004 10:30 AM" will be ' merged with "1/1/2004 1:15 AM" since the dates are the same. 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 ' Set the MergedCellStyle property to enable the merged cell functionality. ' MergedCellStyle also specifies which columns will merge their cells. e.Layout.Override.MergedCellStyle = MergedCellStyle.Always ' MergedCellEvaluator property can be used to speficy custom logic for ' merging cells. e.Layout.Bands(0).Columns("ShipDate").MergedCellEvaluator = New CustomMergedCellEvaluator() End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private class CustomMergedCellEvaluator : Infragistics.Win.UltraWinGrid.IMergedCellEvaluator { public bool ShouldCellsBeMerged( UltraGridRow row1, UltraGridRow row2, UltraGridColumn column ) { DateTime date1 = (DateTime)row1.GetCellValue( column ); DateTime date2 = (DateTime)row2.GetCellValue( column ); // Merge cells according to the date portions of the underlying DateTime cell // values, ignoring any time portion. For example, "1/1/2004 10:30 AM" will be // merged with "1/1/2004 1:15 AM" since the dates are the same. return date1.Date == date2.Date; } } private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // Set the MergedCellStyle property to enable the merged cell functionality. // MergedCellStyle also specifies which columns will merge their cells. e.Layout.Override.MergedCellStyle = MergedCellStyle.Always; // MergedCellEvaluator property can be used to speficy custom logic for // merging cells. e.Layout.Bands[0].Columns["ShipDate"].MergedCellEvaluator = new CustomMergedCellEvaluator( ); }