WF4: ActivityDesigner – How to use WPF custom control in Activity Designer

1. Define the WPF custom control.
2. Refer the Current namespace in activityDesigner
3. Refer the Custom Control from Xaml

<sap:ActivityDesigner x:Class=”WF4ActivityDesignerLibrary.ActivityDesigner.CustomControlDesigner”
xmlns:local =”clr-namespace:WF4ActivityDesignerLibrary” mc:Ignorable=”d” xmlns:d=”; xmlns:mc=”; d:DesignHeight=”67″ d:DesignWidth=”204″>

Note: you can fire the events associated with the Custom Control from the Workflow Custom Activity.



If you are re-building the solution using Visual Studio 2013, modify the solution with following changes.

Replace the following code inside the CustomActivityDesigner.xaml; remove the Data Trigger from the Activity Style


<Style TargetType=”{x:Type sap:ActivityDesigner}”>


<DataTrigger Binding=”{Binding Path=ShowExpanded}” Value=”false”>

<Setter Property=”Template” Value=”{StaticResource CustomTemplate}”/>







<Style TargetType=”{x:Type sap:ActivityDesigner}”>

<Setter Property=”Template” Value=”{StaticResource CustomTemplate}”/>



About ambilykk

I am a Technology Evangelist on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Azure and Visual Studio. Technology adoption and learning is my key strength and technology sharing is my passion.
This entry was posted in ActivityDesigner, WF, WF4. Bookmark the permalink.

10 Responses to WF4: ActivityDesigner – How to use WPF custom control in Activity Designer

  1. Hratch says:

    Hi, You posted this article with the code in 2010, but I opened it lately in Visual Studio 2013, using .net 4.5.1, and I got an error upon dragging the activity in the workflow, and clicking on it once. The error is “InvalidOperationException. The specified Visual is not an ancestor of this Visual..” However, if I close the workflow and open again in Visual studio, the error goes away

  2. Hratch says:

    Can I send u a screen shot ?? I may be doing something wrong ?

  3. Hratch says:

    It works.. I’m not getting the error anymore. Thanks a lot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s