Continuing with the theme of questions we get from customers: How can we store some specific information into activity. One of the cases might be since we don't provide a unique identifier for an activity, the developer wants to store the unique ids per activity. This way he can differentiate between two activities of the same type in the workflow.
This can be accomplished through the ViewStateService. We already use the ViewStateService per activity to store the Expand/Collapse state of the activity. An additional item in the ViewState dictionary would be its unique identifier. So every time an activity is added to the designer surface, we can do the following in the OnModelItemChanged(fired when the activity is added the first time to the designer) event handler.
this.ModelItem, "myId", i++
As you persist this Xaml, you would see something like below for a leaf activity:
<scg:Dictionary x:TypeArguments="x:String, x:Object">
Hope this helps!