0

When I rehost a designer, I can declare variables and their scopes. However, not all activities can be the scope of a variable. I notice Sequence, Parallel, PickBranch can be the host, but Pick, If, Delay, can't. And all of my custom activities currently cannot be the scope of a variable. What should I do to make a custom activity able to be the scope of variables?

Louis Rhys
  • 34,517
  • 56
  • 153
  • 221

1 Answers1

1

It only makes sense to add variables to activities that can have multiple child activities execute. As a result If, Delay etc can't and Sequence, While etc can.

If you want to create you own composite activity add a public Collection<Variable> Variables { get; } to your activity and initialize the collection in the constructor.

Maurice
  • 27,582
  • 5
  • 49
  • 62
  • Thanks, that works. Just an addition, maybe you can add it to your answer for the benefit of other reathers: 1) It's `public Collection Variables` (from `System.Collections.ObjectModel` namespace) and 2) make sure you initialise the collection in the constructor, otherwise it won't show still – Louis Rhys Jan 24 '11 at 03:07
  • I typed the right collection but forgot about SO removing the generic part :-( – Maurice Jan 24 '11 at 07:59