Using the ExpressionTextBox in a Custom Activity Designer

This topic applies to Windows Workflow Foundation 4 (WF4).

This sample shows how to use the ExpressionTextBox in a custom activity designer. The custom activity, MultiAssign, assigns two string values to two string variables. Some ExpressionTextBox controls bind to InArguments and some bind to OutArguments.

Sample details

The ArgumentToExpressionConverter is the type converter used when binding expressions to arguments. The ConverterParameter must be set to In or Out as appropriate. InOut is not supported.

The UseLocationExpression attribute is used on OutArguments to specify that the expression should be an L-value (“left value” or “location value”) expression. In most cases, an L-value expression is a valid Visual Basic identifier used to indicate that the OutArgument being returned is a variable or argument name.

The MaxLines attribute is set to one in this example and MinLines is not set. This indicates that the ExpressionTextBox is a fixed size of one line regardless of the amount of text typed by the user. To allow the ExpressionTextBox to grow to fit user input, set MaxLines greater than MinLines.

An ExpressionTextBox can only be bound to arguments, and cannot be bound to CLR properties.

To use this sample

  1. Using Visual Studio 2010, open the ExpressionTextBoxSample.sln file.

  2. To build the solution, press CTRL+SHIFT+B.

To run this sample

  1. Add a new Workflow Console Application to the solution.

  2. Add a reference to the ExpressionTextBoxSample project from the new Workflow Console Application project.

  3. Build the solution.

  4. Drag the MultiAssign activity from the toolbox and drop it into the workflow.

Ee663224.Important(en-us,VS.100).gif Note:
The samples may already be installed on your computer. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\CustomActivities\CustomActivityDesigners\ExpressionTextBox

See Also

Reference

ExpressionTextBox

Other Resources

Developing Applications with the Workflow Designer