Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
' Create a new ConditionValueAppearance
Dim conditionValueAppearance As ConditionValueAppearance = New ConditionValueAppearance()
' Create a TrueCondition that checks for negative numbers
Dim negativeCondition As OperatorCondition = New OperatorCondition(ConditionOperator.LessThan,0)
' Create an appearance that sets the ForeColor to red.
Dim negativeAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance("Negative")
negativeAppearance.ForeColor = Color.Red
' Create a TrueCondition. The TrueCondition will always resolve to true, so it will
' apply to all cell in the column. However, it will not overwrite appearances properties that
' have already been resolved. So this condition will only apply to cells that do not
' match the previous condition in the list.
Dim positiveCondition As TrueCondition = New TrueCondition()
' Create an appearance that sets the ForeColor to blue.
Dim positiveAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance("Positive")
positiveAppearance.ForeColor = Color.Blue
' Now that we have the conditions and appearances we need, add them to the
' conditionValueAppearance. The conditions will be evaluated in order.
conditionValueAppearance.Add(negativeCondition, negativeAppearance)
conditionValueAppearance.Add(positiveCondition, positiveAppearance)
Me.ultraGrid1.DisplayLay.Bands(0).Columns(0).ValueBasedAppearance = conditionValueAppearance
End Sub