Rehosted Designer does not display workflow activities
-
Tuesday, August 14, 2012 7:10 PM
Hi,
I'm using MS sample to rehost Workflow Designer with WPF.
I literally copy-pasted code from MS sample except that I loaded my workflow instead of one from the sample.
WF Designer does display but it shows only one activity, which is my Flowchart. It does not show all the activities my Flowchart conststs of.
This is code from Sample, which shows workflow with all activities
private void AddWorkflowDesigner()
{
this.WorkflowDesigner = new WorkflowDesigner();
this.DebuggerService = this.WorkflowDesigner.DebugManagerView;
this.WorkflowDesigner.Load("Workflow.xaml");
this.RehostGrid.Children.Add(this.WorkflowDesigner.View);}
This is my code that shows only one Activity (the Flowchart itself). Activities inside the workflow are not shown.
private void AddWorkflowDesigner()
{
this.WorkflowDesigner = new WorkflowDesigner();
this.DebuggerService = this.WorkflowDesigner.DebugManagerView;
this.WorkflowDesigner.Load(new ValidateSetup());
this.RehostGrid.Children.Add(this.WorkflowDesigner.View);}
Can anyone explain why it would be different? I want to display my workflow with all the activities visible.
Thanks.
Isolda
All Replies
-
Wednesday, August 15, 2012 4:34 AMModerator
You think it's a flowchart, but it's not. It's actually a ValidateSetup. Basically there's a difference to displaying the class which is compiled output from a workflow XAML file, versus displaying the input XAML file.
Tim- Proposed As Answer by Tim Lovell-SmithModerator Wednesday, August 15, 2012 4:41 AM
-
Wednesday, August 15, 2012 1:02 PM
Thanks, yes you're right, ValidateSetup is compiled in another assembly, while Workflow.xaml is a file in the same assembly with BuildAction=None. I've tried loading it as a file
this.WorkflowDesigner.Load("ValidateSetup.xaml");
but then I get "“Activity could not be loaded because of errors in the XAML”. I understand it typically means the activity’s type cannot be resolved. Does it mean workflow has to be in the same assemblly as WorkflowDesigner? How can I resolve this?
Thank you.
Isolda
-
Wednesday, August 15, 2012 1:29 PM
Ok, I found this thread http://stackoverflow.com/questions/4189393/activities-are-always-collapsed-in-rehosted-designer that helped.
It says that "workflow instance wrapped in an ActivityBuilder", so loading it as
var activities = WorkflowInspectionServices.GetActivities(new DemoWorkflow());
designer.Load(activities.First());actually loads the flowchart.
I'd appreciate if anyone could explain this or provide a link to a better explanation.
Thank you.
Isolda
- Marked As Answer by LeoTangModerator Tuesday, August 21, 2012 1:51 AM
-
Wednesday, August 15, 2012 6:34 PMModerator
This might be helpful
http://blogs.msdn.com/b/mwinkle/archive/2009/10/23/types-metatypes-and-bears-redux.aspx
- Marked As Answer by LeoTangModerator Tuesday, August 21, 2012 1:51 AM

