I have configured conditional formatting for the values in a grid (red on negative), however, this formatting does not apply to the row summaries (group by footers or grand total summary).
Is there a way to do this without a Draw Filter, and if not, can you provide the specifics of what to object type to check for in the GetPhasesToFilter and how to obtain the value in the summary row in the DrawElement method so the foreground color can be set there?
Thanks,
Dana
Hi Dana,
That will work, but there is an easier way that does not require a DrawFilter:
Private Sub UltraGrid1_SummaryValueChanged(sender As Object, e As Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs) Handles UltraGrid1.SummaryValueChanged If (e.SummaryValue.Value < 0) Then e.SummaryValue.Appearance.ForeColor = Color.Red End If End Sub
I have figured this out. Here is the code:
In the GetPhasesToFilter draw filter function:
If (TypeOf (drawParams.Element) Is SummaryFooterUIElement) Then Return Infragistics.Win.DrawPhase.BeforeDrawForegroundEnd If
In the DrawElement draw filter function:
If (TypeOf (drawParams.Element) Is SummaryFooterUIElement) Then If Not CType(drawParams.Element, SummaryFooterUIElement).GetContext Is Nothing Then Dim rows As RowsCollection = CType(CType(drawParams.Element, SummaryFooterUIElement).GetContext, RowsCollection) For Each summary As SummaryValue In rows.SummaryValues If summary.Value < 0 Then summary.Appearance.ForeColor = Color.Red End If Next End IfEnd If