How to set activity property from a custom input form

Sometime you might want to create an input form for your user to set properties on your custom activity. Unfortunately when you set the properties directly on the activity from the input form the values don’t always get reflected on your activity. To resolve this you need to set the value on the PropertyDescriptor for the property instead, like the following:

PropertyDescriptor firstPropDescr = TypeDescriptor.GetProperties(this.activity)["FirstName"];

firstPropDescr.SetValue(this.activity, txtFirstName.Text);

Below is a link to a sample employee activity that when you double click in it a input form pops up to enter the first and last name. Clicking the OK button sets the values on the activity.

InputActivity.exe