Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
850
Create a condition group
posted

Is there any way to add a condition group in runtime?

I mean, without use "Conditional Formatting dialog box"

  • 469350
    Offline posted

    Just an FYI - the Conditional Appearances functionality is really designed to help you make things easier at design-time.

    If you are going to apply appearances to your cells or rows at run-time, then it's much easier and a lot less code to simply use the InitializeRow event of the grid.

  • 69832
    Offline posted

    //  Populate a ConditionGroup with two separate conditions
    OperatorCondition condition1 = new OperatorCondition( ConditionOperator.StartsWith, "a", false );
    OperatorCondition condition2 = new OperatorCondition( ConditionOperator.StartsWith, "z", false );
    ConditionGroup group = new ConditionGroup();
    group.Add( condition1 );
    group.Add( condition2 );

    //  Create an Appearance for the conditions
    Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
    appearance.ForeColor = Color.Red;

    //  Create a ConditionValueAppearance using the ConditionGroup and Appearance
    //  we created above
    ConditionValueAppearance valueAppearance = new ConditionValueAppearance();
    valueAppearance.Add( group, appearance );

    //  Assign the ConditionValueAppearance to the column's ValueBasedAppearance
    this.ultraGrid.DisplayLayout.Bands[0].Columns["whatever"].ValueBasedAppearance = valueAppearance;