Windows Workflow Foundation 4.0 ActivityDesigner


  • Hello. At me is custom activity and connected with it activityDesigner. By pressing the button which is located on activityDesigner show WPF forms in which the user sets value. At closing of this form value should be displayed in ExpressionTextBox. Prompt, whether is possible so to connect to (display)?

    <sap:ActivityDesigner x:Class="ActivityLibrary.SendMailDesigner"







    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation" mc:Ignorable="d" xmlns:d="" xmlns:mc="" >


    <sapc:ArgumentToExpressionConverter x:Uid="sadv:ArgumentToExpressionConverter_1" x:Key="argumentToExpressionConverter" />



    <Grid Height="108" HorizontalAlignment="Left" Name="grid1" VerticalAlignment="Top" Width="278">

    <Label Content="Body" HorizontalAlignment="Left" Name="labelBody" VerticalAlignment="Top" />

    <sapv:ExpressionTextBox Grid.Column="1" HorizontalAlignment="Left" Name="ctrlBody" VerticalAlignment="Top"


    Expression="{Binding Path=ModelItem.Body, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"

    ExpressionType="{x:Type TypeName=s:String}"

    OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}"

    /> - my ActivityDesigner

    public partial class SendMailDesigner


    private void button1_Click(object sender, RoutedEventArgs e)


    MainWindow f = new MainWindow();

    if (f.ShowDialog() == true)


    object o = f.Test;// f.Test - string

    this.ctrlBody.Expression - how set value ???


    Thursday, January 21, 2010 2:35 PM

All replies

  • Let's say that your ETB is bound to "Foo" [in your code above, you bind to Body, I'm not sure that's what you want to bind it to, unless Body is the expression, you likely want to bind it to an InArgument<String> ]

    Anyway, in the code beside you need to do

    this.ModelItem.Properties["Foo"].SetValue(your value here)

    Now, if an ETB is bound to Foo, you most likely want to wrap whatever is returned from the dialog in a VBValue expression

    which would look like

    this.ModelItem.Properties["Foo"].SetValue(new VisualBasicValue { ExpressionText= "your constructed VB expression string here" } );

    Basically, you don't want to try to set the Expression directly on the UI Element, write it to the underlying data object that the ETB is bound to.


    Program Manager -- wf designer --
    Thursday, January 21, 2010 5:49 PM
  • Thanks for the help. At me it has turned out..

      Window1 f = new Window1();
       if (f.ShowDialog() == true)
        Argument ArgDoc = Argument.Create(typeof(Guid), ArgumentDirection.In);
        ArgDoc.Expression = new VisualBasicValue<Guid>
         ExpressionText =

    Wednesday, January 27, 2010 12:12 PM