Hi all,
I'm creating an application that rehost workflow designer. What I did is following the tutorial from Apress' Pro WF 4 books.
The principle of the tutorial is:
1. Use WorkflowDesigner
class to read workflow xaml file, and bind WorkflowDesigner.View
and PropertyView
property into ContentControl
in the UI.
2. Use System.Activities.Presentation.Toolbox.ToolboxControl
class to create VS-like Toolbox so that user can drag-and-drop whatever activities that added into this toolbox
3. ToolboxControl
uses ToolboxCategory
and ToolboxItemWrapper
to construct its content.
Okay, my question is here related to ToolboxItemWrapper
class. Based on the documentation, the constructor is using a Class Type, not an Instance. So when we drag and drop, it will instantiate the class into an instance.
Here is the documentation:
http://msdn.microsoft.com/en-us/library/system.activities.presentation.toolbox.toolboxitemwrapper.aspx
However, what I want to hack ToolboxItemWrapper
so that it can accept an instance, then when we drag and drop it into WorkflowDesigner.View
, the View will show the instance.
Any idea or clues how to achieve this functionality?
Reason why I need this feature:
We want to make it easier for user when adding an 'instance' into the designer. when you have a 'type' in toolbox, after dragging and dropping you need to setup the parameter. When we have 'instance' in toolbox, what user needs to do is just dragging and dropping and that's all. No need to enter parameter to set the 'type'. Less steps for user when creating their workflow.
Another constraint is the list of activities in the toolbox depends on a specific module. This specific module will generate a list of instances. Then I want to convert these generated instances into entries in toolbox. I'll add this info on the questions