Dynamically customize property grid of activity

Hi,

Does anyone know how to go about customizing the properties grid of a custom workflow activity? Basically, the fields available in the properties grid are to be automatically populated based on a config file for the activity which lists out the properties required. The list will differ from activity to activity and I'll like to be able to build this customization inside the base activity class.

Regards,
TL

[428 byte] By [tl.tang] at [2008-1-9]
# 1

Hi TL,

Code Snippet

internal class BaseCustomActivityDesigner: ActivityDesigner

{

protected override void PreFilterProperties(IDictionary properties)

{

// Get data from config file.

string sPName = ConfigurationManager.AppSettings.Get("ParamName");

string sPType = ConfigurationManager.AppSettings.Get("ParamType");

// Add

properties[sPName] = new ParameterBindingPropertyDescriptor<BaseCustomActivity>(sPName, typeof(sPType), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible

), new BrowsableAttribute(true)});

}

}

Code Snippet

[Designer(typeof(BaseCustomActivityDesigner), typeof(IDesigner))]

public partial class BaseCustomActivity: Activity

{

}

You can dynamically add property to property grid of activity .

Regards,

KHA

kmhsad at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
Hi Kmhsad,

Thanks for your code snippets, its exactly what I needed.

I also managed to find an example with full source code included at Guy Burstein's Blog. Hope it helps the next person who needs to do something like this too.

tl.tang at 2007-10-3 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified