Implementing a custom expression editor

I’ve seen a few forum posts about providing a richer expression editing experience in a rehosted workflow designer. There are two main scenarios in which you would want to implement your own expression editor:

  1. Work around the rather unfortunate limitation that the hostable editor is not available outside of Visual Studio, so therefore there is no support for IntelliSense in a rehosted application
  2. Simplify the expression editing experience for the business analyst audience, so that analysts are not required to learn VB or deal with VB expressions.

Our intrepid expression editor tester, Eric Wong, put together a small app that demonstrates the process of implementing a custom expression editor. There are three basic steps:

  1. Implement the IExpressionEditorService interface. The IExpressionEditorService interface manages the creation and destruction of expression editors.
  2. Implement the IExpressionEditorInstance interface. This interface will contain the guts of your expression editing UI.
  3. Publish the IExpressionEditorService in your application.

Eric’s app has two projects, a class library that implements the editor service and instance and a WPF application that rehosts the designer and publishes the service. The class library is a proof of concept, and doesn’t do anything terribly interesting (you’ll have to roll your own IntelliSense). The most important part of the example is the code that he uses to publish the service, called MyEditorService. Here it is:

        public void createDesigner()
WorkflowDesigner designer = new WorkflowDesigner();

Sequence root = new Sequence()
Activities = {
new Assign(),
new WriteLine()}

Grid.SetColumn(designer.View, 0);

// Create ExpressionEditorService
this.expressionEditorService = new MyEditorService();


You can test out Eric’s app using some of the many keyboard shortcuts associated with IntelliSense commands. For example, Ctrl+J invokes IntelliSense, Ctrl+K, I invokes QuickInfo, etc. Thanks Eric for sharing this out.

Comments (9)

  1. AdrianoT says:

    Thanks Cathy and Eric for sharing this sample which is very useful to understand the service logic required to inject custom expression editors, which is one of the aspects I was looking for in my re-hosting.


  2. unbornchikken says:

    Thanks! I hope there will be more WF4 articles in the future!

  3. RuiM says:

    hi i´m trying to implement Intellisense on the new rehosting wf 4.0.

    great example this one to understand the concept but do you have more articles with this subject ou examples…


    Rui M.

  4. mtaheri says:

    Your article is too short and lacks brief explanations. Please add extra notes or samples in further writings.

  5. Madhur says:


    I am using the same code but it does not work as expected , please let me know if i am missing something.

    I run the application ,click on Assign activity to get the intellisense but it is not showing the variables and other custom activities and their properties in expression box.

  6. Not working says:

    Did anybody succeed to make this working?

  7. YB says:

    Was anyone able to use the sample code to work?

  8. DJ says:

    I have followed the many rabbit holes this line of enquiry leads to – eventually we went to the very helpful Actipro software who provide an Intelliprompt WPF control. They even wrote up the solution as a 'tip and trick' to guide us in how to use the control to achieve our goal.…/Enhancing-the-Windows-Workflow-Designer.aspx

Skip to main content