locked
Rehosted Designer does not display workflow activities RRS feed

  • Question

  • 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

    Tuesday, August 14, 2012 7:10 PM

Answers

All replies

  • 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

    Wednesday, August 15, 2012 4:34 AM
  • 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:02 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 LeoTang Tuesday, August 21, 2012 1:51 AM
    Wednesday, August 15, 2012 1:29 PM
    • Marked as answer by LeoTang Tuesday, August 21, 2012 1:51 AM
    Wednesday, August 15, 2012 6:34 PM