Thursday, March 18, 2010

Creating custom activity in Workflow Part – 5

Hi All,

In previous parts, we saw how to deal with custom activities main validation logic, execution logic and some cosmetic tips. We will carry on some nice look and feel for the custom activity in this post as well.

If you haven’t gone through the previous post, then I recommend reading Creating custom activity in Workflow Part – 1 first and then continue reading further.

This post will show you the way we can implement an image associated with custom activity. When we drag and drop the custom activity on designer surface, we can attach PNG image of ideally 16 * 16 sizes.

We have to add ToolboxBitmap attribute to the CustomActivityDesigner class and the Custom Activity class with path to the 16 * 16 PNG picture.

If you apply ToolboxBitmap attribute to only Custom Activity class, then you will see the image on designer custom activity only. However, if you apply ToolboxBitmap attribute to CustomActivityDesigner class, then you will also find the image for custom activity in the toolbox as well.

Modify the classes as shown below.





And below is the result of applying attribute to both classes.



Now you will wonder I have given local path of my system. If you give this custom activity’s DLL to any other developer, how image will appear.

Well, answer to the question is very simple. No need to worry about image. Image is built as a part of embedded resource in assembly. So image will automatically be included with DLL.

I hope that you have liked this series of basic custom activity. Share with us your thoughts on this.

Read Creating custom activity in Workflow Part – 6 to explore more.

No comments:




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com