Customizing ActivityDesigner in Workflow 4.0

    General discussion

  • I thought of having some customized ActivityDesigner in a DLL, not executable (as in EXE, we could have app.xaml file). To achieve this,I created a BaseDesigner which is derived from ActivityDesigner.



    public class BaseDesigner : System.Activities.Presentation.ActivityDesigner

    { public BaseDesigner(){}}

    Added a ResourceDictionary & created the Style for BaseDesigner

    <ResourceDictionary x:Uid="ResourceDictionary_1" xmlns=""






















    <Style TargetType="{x:Type swd:ActivityDesigner}">




    <Setter Property="Template">





    (ControlTemplate from Kushals post -

    I changed the ControlTemplate to hide the Icon on the ActivityDesigner & set TargetType to "BaseDesigner" (Intially TargetType was "local:BaseDesigner" but that didn't work so changed to "swd:ActivityDesigner".

    Now created 2 custom activites & their designers. In one of the custom designer, I am merging the created ResourceDictionary (ActivityDesigner1.xaml).


    <local:BaseDesigner x:Class="WF4ActivityDesignerLibrary.ActivityDesigner.ActivityDesigner1"
            <ResourceDictionary Source="/WF4ActivityDesignerLibrary;component/CustomWorkflowElementDesignerTemplate.xaml"/>

    In another designer, directly putting the ControlTemplate code in Resources section (ContainerActivityDesigner.xaml).





    local:BaseDesigner ...add the references from above code





    <ResourceDictionary>... Put ControlTemplate code here</ResourceDictionary>












    <Style TargetType="{x:Type local:BaseDesigner}">








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




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

















    Save files, Add a WF console app & add a reference to above created project. Now drag the custom activites on Workflow.xaml file. You will notice the difference (there is no change in first designer while another designer hides the activity icon).

    I am not sure if I am missing anything. I tried merging the ResourceDictionary even in code behind file of BaseDesigner but no success. Now suppose if I need to customize ActivityDesigner & create multiple custom activity designers, how could I achieve this as it is practically not possible to put the ControlTemplate code in each individual activity designer.

    I have gone thru the Kushals post at but in that, App.xaml file used & in cs file, he is actually getting the style & applying that style to MS provided activity designers. In my case, it is custom designer & w/o any app.xaml file. Any help would be appreciable.

    • Moved by Xinyan Ma 马欣妍 Wednesday, April 20, 2011 5:21 AM forum cleanup (From:MSDN, TechNet, and Expression Profile and Recognition System Discussions)
    Thursday, August 12, 2010 10:41 AM