This documentation is archived and is not being maintained.

RuleConditionDialog Class

This dialog is normally used by the activities IfElseBranchActivity, WhileActivity, ConditionedActivityGroup, and ReplicatorActivity to edit declarative conditions. However, if you want to use conditions outside of these activities (for example, edit a condition for use outside of a workflow completely), you can use this dialog to perform the editing of the condition.

Namespace:  System.Workflow.Activities.Rules.Design
Assembly:  System.Workflow.Activities (in System.Workflow.Activities.dll)

public class RuleConditionDialog : Form

To use the dialog box, create an instance and show the dialog. If OK is selected, the property Expression contains the CodeExpression entered by the user.

For example, to create a CodeExpression where the "this" activity is a class you want to use, and execute the condition if OK is pressed, you could use:

    // Start with no expression.
    CodeExpression expression = null;

    using (RuleConditionDialog dialog = new RuleConditionDialog(typeof(TestClass), null, expression))
        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            expression = dialog.Expression;
            RuleExpressionCondition condition = new RuleExpressionCondition(expression);
            RuleValidation validation = new RuleValidation(typeof(TestClass), null);
            if (condition.Validate(validation))
                RuleValidation execution = new RuleExecution(validation, new TestClass());
                Console.WriteLine("Expression evaluates to " + condition.Evaluate(execution));


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0