Here's a small sample on how to add a new Verb and another SmartTag option to your custom Activity in the Windows Workflow Designer. Adding a new context-menu option to your activity is fairly easy and intuitive: You just need to create a new instance of the ActivityDesignerVerb class when your custom ActivityDesigner-derived class in initialized and add it to the Verbs collection.

Adding a new SmartTag option is a little bit more work. SmartTag options are also ActivityDesignerVerb instances; however, configured SmartTags are returned by the SmartTagVerb property as a readonly collection. To add a new one, you need to override this property and return you own collection instead.


Here's a small code sample that adds a single new "Save Image" Verb to right-click menu as well as adding a SmartTag for it:

public class CodeFirstSequentialActivityDesigner : SequenceDesigner


   // ...


   private List _smartTagVerbs =

      new List();


   /// <summary>

   /// Overide the SmartTagVerbs collection to return our own

   /// summary>

   protected override ReadOnlyCollection SmartTagVerbs


      get { return _smartTagVerbs.AsReadOnly(); }



   /// <summary>

   /// Override the Initialize method to add

   /// our custom verbs

   /// summary>

   /// <param name="activity">Activity to associate with this

   /// designer instanceparam>

   protected override void Initialize(Activity activity)




      // get parent verbs and add them before our own custom verbs



      ActivityDesignerVerb saveImageVerb = new ActivityDesignerVerb(

         this, DesignerVerbGroup.Misc,

         "Save Image", OnSaveImageVerbSelected


      saveImageVerb.Enabled = true;

      saveImageVerb.Supported = true;


      // add an image

      Guid  imageProp = new Guid("B4C2B905-A6D3-4CD6-A91A-5005A02B9676");

      saveImageVerb.Properties[imageProp] =


      // add verb to both verb collections





   private void OnSaveImageVerbSelected(object sender, EventArgs e)


      string name = Activity.Name;

      Bitmap emptyImage = new Bitmap(Size.Width, Size.Height,


      using ( Graphics graphics = Graphics.FromImage(emptyImage) )


         Image ourReflection = this.GetPreviewImage(graphics);

         using ( SaveFileDialog dlg = new SaveFileDialog() )


            dlg.Filter = "Image File (*.png)|*.png";

            DialogResult res = dlg.ShowDialog();

            if ( res == DialogResult.OK )


               ourReflection.Save(dlg.FileName, ImageFormat.Png);







Tomas Restrepo

Software developer located in Colombia.