1

I've a sample workflow application, which only have to display an activity an show on which step we are.

The problem is that when I load my activity like this:

TestWorkflow workflow = new TestWorkflow();
_workflowApplication= new WorkflowApplication(workflow );
_workflowDesigner = new WorkflowDesigner();
_workflowDesigner.Load(workflow );
uxGridWorkflowHoster.Children.Add(_workflowDesigner.View);

I'm getting only the root element "sequence" in my box. how to change that?

I get that on visual studio The workflow on visual studio

And in my app, I see only that:

App view

Thank you!

J4N
  • 19,480
  • 39
  • 187
  • 340

1 Answers1

1

The problem is that TestWorkflow doesn't have a designer associated with it, and the design surface doesn't realize that TestWorkflow is an Activity that is composed out of other activities, and it should display the root of its implementation rather than the TestWorkflow activity itself.

I don't know the best way to deal with this, but I've used the following hack. It gets the first activity (the root) of TestWorkflow and wraps it in an ActivityBuilder.

var rootActivity = WorkflowInspectionServices
                       .GetActivities(new TestWorkflow())
                       .FirstOrDefault();

var builder = new ActivityBuilder
              {
                  Implementation = rootActivity,
                  //Name = PartType.Name (whoops, should have cut that out)
              };
_workflowDesigner.Load(builder);
  • And when wrapped to the activity builder, the whole sequence will be displayed? – J4N Apr 13 '11 at 19:33
  • @J4N: Yes. I'm doing this myself in a rehosted designer. –  Apr 13 '11 at 20:53
  • in fact, since my activities are in a different project I don't have this problem anymore :) – J4N Apr 15 '11 at 05:05
  • where does this code go? in a native activity? in an activity designer file? I'm trying to apply this to a tfs2010 build scenario with 2 delegated nullable actions available. – Maslow Apr 29 '11 at 18:22
  • It goes where you load the WorkflowDesigner (see the last line?) –  Apr 29 '11 at 18:34