ExpressionTextBox – works on Activity properties too!

So Matt Winkler read my previous post and said hey, what about properties of type Activity<foo>, can’t they be bound to ExpressionTextBoxes too? Snap, I had forgotten about that case. The answer is actually yes, because VisualBasicValue and VisualBasicReference derive from Activity, expressions are then assignable to Activity and then the activity can be scheduled. This is a special case of the property binding. The ExpressionTextBox always generates a VBValue or VBReference and if the returned object is assignable to the property, then the binding is valid and the expression can be serialized.

So for an activity that looks like this:

namespace WorkflowConsoleApplication3
    public sealed class CodeActivity1 : CodeActivity
        public Activity<bool> Foo { get; set; }

        protected override void Execute(CodeActivityContext context)

The designer looks like this:

<sap:ActivityDesigner x:Class="WorkflowConsoleApplication3.CodeActivityDesigner1"

        <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.Foo, Mode=TwoWay}"
                                ExpressionType="{x:Type TypeName=s:Boolean}"
                                OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}"/>  


Good catch Matt, thanks. Happy holidays.

Comments (0)

Skip to main content