Is it possible to declare total WF4 activity in XAML?

I have a Workflow 4 activity that can be run on any number of classes that inherit from my base class. Thus, the activity, of course, is general in nature. Like ForEach or AddToCollection actions, my activity requires a type parameter.

My question is: can I create this work in the designer using XAML? Keep in mind that this is a complex activity, so the developer seems to be the best choice.

If I created it in code, it would look like this:

public class MyGenericActivity<T> : Activity where T : MyBaseClass { //args would go here public MyGenericActivity() { this.Implementation = () => new Sequence { Activities = { //... } }; } } 

Although this solution will work, the service will certainly be painful, and you will not get any of the β€œsubtleties” of the designer in this way.

+4
source share
2 answers

The XAML stack may support it (not sure), but in VS 10 the workflow designer definitely does not allow you to do this.

+1
source

Not sure if you can, but I suspect not. But even if you could, why would you? Xaml activity is just markup and layout, no code, so how would you use a generic type.

Development experience for those who use your activity is not related to how you create your activity. Just add a designer and give the user any design of the time that you like. You can allow them to add multiple child activities using WorkflowItemsPresenter.

0
source

All Articles