Converting a WF program instance to XAML

In real applications, we would like to write and test WF programs in imperative code, while storing, running, and transmitting workflow as an XAML string or file. In this task, we will convert a WF program instance to an XAML string.

How to do it...

  1. Create a workflow project:

    Create a new Workflow Console Application under the Chapter01 solution and name the project ConvertWFInstanceToXML. Delete the Workflow1.xaml file that is created by default.

  2. Write code to create the workflow and its host:

    Open Program.cs file and change the code as follows:

    using System; using System.Activities; using System.Activities.Statements; using System.Text; using System.Xaml; using System.Activities.XamlIntegration; using System.IO; ...

Get Microsoft Windows Workflow Foundation 4.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.