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
using Infragistics.Win; using Infragistics.Win.UltraWinGrid; private void button2_Click(object sender, EventArgs e) { // Create a new ConditionValueAppearance ConditionValueAppearance conditionValueAppearance = new ConditionValueAppearance(); // Create a TrueCondition that checks for negative numbers OperatorCondition negativeCondition = new OperatorCondition(ConditionOperator.LessThan, 0); // Create an appearance that sets the ForeColor to red. Infragistics.Win.Appearance negativeAppearance = 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. TrueCondition positiveCondition = new TrueCondition(); // Create an appearance that sets the ForeColor to blue. Infragistics.Win.Appearance positiveAppearance = 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); this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].ValueBasedAppearance = conditionValueAppearance; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2