views:

372

answers:

3

I have given user a re-hosted designer with custom activites so that user can create its own workflows. Now I want to give user option to save the workflow designed in re-hosted designer, an Xaml file, in WF 4.0. I want to save workflow along with the activity variable/property values. How can I do that?

A: 

workflow designed in re-hosted designer can be saved by workflow.save(filename) method along with the property values of activites and defined variables. The method can be called inside any event handler of re-hosted designer for example on form closing event.

+2  A: 

Two main options

1) WorkflowDesigner.Save() Method (System.Activities.Design (Beta1)/System.Activities.Presentation (Beta2))

2) XamlServices.Save() Method (System.Xaml), with the object (object graph) to save being EditingContext.ModelTreeManager.Root

Try WorkflowDesigner.Save() as your first option, and fall back on XamlServices() if you find you need to do something that won't work in WorkflowDesigner.Save(), since there are more low-level control options available.

Tim Lovell-Smith
A: 

Hi! You can follow this example about WF4. In that example you can find three basic methods: Open, Save and Run.

So long!

John Ortiz