我有这个 ultraGrid:
http://s4.postimg.org/fhnjs4w4d/Capture.png
我需要把带有红色标记的列中的自定义值传递给汇总单元格。
Infragistics允许我在汇总单元格中放置最大值、最小值、总和、平均值等,但我需要传递自定义值。
有什么帮助吗?
我有这段代码可以放置最大值:
Dim columnToSummarizeVlrAq As UltraGridColumn = ugbBens.DisplayLayout.Bands(0).Columns(ugbBensColVlrAq)
Dim summaryVlrAq As SummarySettings = .Add(ugbBensColVlrAq,SummaryType.Maximum, columnToSummarizeVlrAq, SummaryPosition.UseSummaryPositionColumn)
这里是解决方案:
创建一个新类:
Public Class MyCustomSummarySettings
Implements ICustomSummaryCalculator
Private valor As Object = 0
Public Sub New()
End Sub
Public Sub Val()
End Sub
Private Sub BeginCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) Implements ICustomSummaryCalculator.BeginCustomSummary
valor = 0
End Sub
Private Sub AggregateCustomSummary(ByVal summarySettings As SummarySettings, ByVal row As UltraGridRow) Implements ICustomSummaryCalculator.AggregateCustomSummary
'Primeiro mês
If summarySettings.Key = "COL_DeprAntExVlrRv" Then
If row.Index = 0 Then valor = CDbl(row.Cells("COL_DeprAntExVlrRv").Value)
End If
If summarySettings.Key = "fltVlrDepreciavelAct" Then
If row.Index = 0 Then valor = CDbl(row.Cells("fltVlrDepreciavelAct").Value)
End If
End Sub
Private Function EndCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) As Object Implements ICustomSummaryCalculator.EndCustomSummary
Return valor
End Function
End Class
并使用自定义的摘要类型调用类,就像这样:
Dim custumSummary As New MyCustomSummarySettings
summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing) '7ª Coluna