Version

OperatorCondition Constructor(ConditionOperator,Object)

Creates a new OperatorCondition instance.
Syntax
'Declaration
 
Public Function New( _
   ByVal conditionOperator As ConditionOperator, _
   ByVal compareValue As Object _
)
public OperatorCondition( 
   ConditionOperator conditionOperator,
   object compareValue
)

Parameters

conditionOperator
The ConditionOperator used to evaluate a match.
compareValue
The value against which to compare.
Example
The following code demonstrates how to create an OperatorCondition and a FormulaCondition, make them part of a ConditionGroup, then associate them with an Appearance object through a ConditionValueAppearance. This example uses an UltraGrid to demonstrate an application of Conditional Formatting.

Imports Infragistics.Win
Imports Infragistics.Win.CalcEngine

Private  Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
	' Create a new ConditionValueAppearance
	Dim conditionValueAppearance As ConditionValueAppearance =  New ConditionValueAppearance() 
 
	' Create a ConditionGroup
	Dim conditionGroup As ConditionGroup =  New ConditionGroup() 
 
	' Create a OperatorCondition that checks for numbers that are greater than or 
	' equal to -2. 
	Dim operatorCondition As OperatorCondition =  New OperatorCondition(ConditionOperator.GreaterThanOrEqualTo,-2) 
 
	' Create a FormulaCondition that checks for numbers that are less than or 
	' equal to 2.  The column passed into the constructor is the column that the FormulaCondition
	' will be a part of, and acts as the IFormulaProvider
	Dim formulaProvider As IFormulaProvider =  Me.ultraGrid1.DisplayLay.Bands(0).Columns(0) 
	Dim formulaCondition As FormulaCondition =  New FormulaCondition(formulaProvider,"[ConditionValue] <= 2") 
 
	' Add the two conditions to the conditionGroup
	conditionGroup.Add(operatorCondition)
	conditionGroup.Add(formulaCondition)
 
	' We only want the color to apply to cells that meet both conditions. So we
	' will set the Logical Operator to 'And'.
	conditionGroup.CombineOperator = LogicalOperator.And
 
	' Create an appearance that sets the ForeColor to green.
	Dim greenAppearance As Infragistics.Win.Appearance =  New Infragistics.Win.Appearance("Between -2 and +2") 
	greenAppearance.BackColor = Color.Green
	greenAppearance.ForeColor = Color.White
 
	' Now that we have the condition and appearance we need, add them to the 
	' conditionValueAppearance. 
	conditionValueAppearance.Add(conditionGroup, greenAppearance)
 
	' Finally, assign the ConditionValueAppearance to the column
	Me.ultraGrid1.DisplayLay.Bands(0).Columns(0).ValueBasedAppearance = conditionValueAppearance
End Sub
using Infragistics.Win;
using Infragistics.Win.CalcEngine;


private void button1_Click(object sender, EventArgs e)
{
	// Create a new ConditionValueAppearance
	ConditionValueAppearance conditionValueAppearance = new ConditionValueAppearance();

	// Create a ConditionGroup
	ConditionGroup conditionGroup = new ConditionGroup();

	// Create a OperatorCondition that checks for numbers that are greater than or 
	// equal to -2. 
	OperatorCondition operatorCondition = new OperatorCondition(ConditionOperator.GreaterThanOrEqualTo, -2);

	// Create a FormulaCondition that checks for numbers that are less than or 
	// equal to 2.  The column passed into the constructor is the column that the FormulaCondition
	// will be a part of, and acts as the IFormulaProvider
	IFormulaProvider formulaProvider = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0];
	FormulaCondition formulaCondition = new FormulaCondition(formulaProvider, "[ConditionValue] <= 2");
            
	// Add the two conditions to the conditionGroup
	conditionGroup.Add(operatorCondition);
	conditionGroup.Add(formulaCondition);

	// We only want the color to apply to cells that meet both conditions. So we
	// will set the Logical Operator to 'And'.
	conditionGroup.CombineOperator = LogicalOperator.And;

	// Create an appearance that sets the ForeColor to green.
	Infragistics.Win.Appearance greenAppearance = new Infragistics.Win.Appearance("Between -2 and +2");
	greenAppearance.BackColor = Color.Green;
	greenAppearance.ForeColor = Color.White;

	// Now that we have the condition and appearance we need, add them to the 
	// conditionValueAppearance. 
	conditionValueAppearance.Add(conditionGroup, greenAppearance);

	// Finally, assign the ConditionValueAppearance to the column
	this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].ValueBasedAppearance = conditionValueAppearance;
}
Requirements

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

See Also