<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Matt W's Windows Workflow Place : vs10</title><link>http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx</link><description>Tags: vs10</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Introduction to WF Designer Rehosting (Part 2)</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/17/introduction-to-wf-designer-rehosting-part-2.aspx</link><pubDate>Wed, 17 Jun 2009 20:18:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9769899</guid><dc:creator>mwinkle</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9769899.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9769899</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;standard beta disclaimer.&amp;#160; This is written against the beta1 API’s.&amp;#160; If this is 2014, the bits will look different.&amp;#160; When the bits update, I will make sure to have a new post that updates these (or points to SDK samples that do)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In yesterday’s post, we went over the core components of the designer.&amp;#160; Let’s now take that and build that rehosts the designer, and then we’ll circle back around and talk about what we did and what comes next.&lt;/p&gt;  &lt;p&gt;Start VS, Create a new project, and select a WPF project&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb.png" width="553" height="398" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Inside the VS project add references to the System.Activities.* assemblies.&amp;#160; For now, that list looks like&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;System.Activities.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Design.Base.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Design.dll&lt;/li&gt;    &lt;li&gt;System.Activities.Core.Design.dll&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_1.png" width="355" height="292" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You might think the list of design assemblies is excessive.&amp;#160; We’ll be collapsing probably into two design assemblies, one with the designer infrastructure and one with the activity designers in subsequent milestones.&lt;/p&gt;  &lt;p&gt;Create some layout in the WPF window to hold the various designer elements.&amp;#160; I usually do a three column grid for toolbox, property grid and designer canvas.&lt;/p&gt;  &lt;p&gt;The XAML for this looks roughly like this:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt; &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BlogPostRehosting.Window1&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Window1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;664&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;831&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Now that we’ve got the layout down, let’s get down to business.&amp;#160; First let’s just get an app that displays the workflow designer and then we will add some other interesting features. We wanted to make it easy to get a canvas onto your host application, and to program against it.&amp;#160; The key type that we use is &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner(VS.100).aspx"&gt;WorkflowDesigner&lt;/a&gt;, this encapsulates all of the functionality, and operating context, required.&amp;#160; Let’s take a quick look at the type definition &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td width="334"&gt;Name&lt;/td&gt;

      &lt;td width="365"&gt;Description&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.context(VS.100).aspx"&gt;Context&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets or sets an EditingContext object that is a collection of services shared between all elements contained in the designer and used to interact between the host and the designer. Services are published and requested through the EditingContext.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.contextmenu(VS.100).aspx"&gt;ContextMenu&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets the context menu for this designer.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.debugmanagerview(VS.100).aspx"&gt;DebugManagerView&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.debug.debuggerservice(VS.100).aspx"&gt;Provides a DebuggerServicethat is used for runtime debugging. &lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.propertygridfontandcolordata(VS.100).aspx"&gt;PropertyGridFontAndColorData&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Sets the property grid font and color data.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.propertyinspectorview(VS.100).aspx"&gt;PropertyInspectorView&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Returns a UI element that allows the user to view and edit properties of the workflow.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.text(VS.100).aspx"&gt;Text&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Gets or sets the XAML string representation of the workflow.&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td width="334"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.workflowdesigner.view(VS.100).aspx"&gt;View&lt;/a&gt;&lt;/td&gt;

      &lt;td width="365"&gt;Returns a UI element that allows the user to view and edit the workflow visually. &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The editing context is where we will spend more time in the future, for now the View is probably what’s most interesting, as this is the primary designer canvas.&amp;#160; There are also some useful methods to load and persist the workflow as well. &lt;/p&gt;

&lt;p&gt;Let’s start off real simple, and write some code that will display a basic sequence, and we’ll get more sophisticated as we go along.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Controls;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Design;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Core.Design;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Statements;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; BlogPostRehosting&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="rem"&gt;/// Interaction logic for Window1.xaml&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Window1 : Window&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; Window1()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            InitializeComponent();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            LoadWorkflowDesigner();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadWorkflowDesigner()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            WorkflowDesigner wd = &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowDesigner();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            (&lt;span class="kwrd"&gt;new&lt;/span&gt; DesignerMetadata()).Register();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            wd.Load(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                            { &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                                Activities = &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                                {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Persist(), &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; WriteLine()&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                                }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                            });&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            Grid.SetColumn(wd.View, 1);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            grid1.Children.Add(wd.View);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Let’s walk through this line by line:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Line 22, construct the workflow designer&lt;/li&gt;

  &lt;li&gt;Line 23, Call Register on the DesignerMetadata class.&amp;#160; Note that this associates all of the out of the box activities with their out of the box designers.&amp;#160; This is optional as a host may wish to provide custom editors for all or some of the out of box activities, or may not be using the out of box activities.&lt;/li&gt;

  &lt;li&gt;Line 24-31, Call Load, passing in an instance of an object graph to display.&amp;#160; This gives the host some flexibility, as this instance could come from XAML, a database, JSON, user input, etc.&amp;#160; We simply create a basic sequence with two activities&lt;/li&gt;

  &lt;li&gt;Line 32, set the column for the view&lt;/li&gt;

  &lt;li&gt;Line 33, add the view to the display&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This gives us the following application:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_2.png" width="466" height="389" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now, that was pretty simple, but we’re also missing some key things, namely, the property grid.&amp;#160; It’s important to note however that this has all of the functionality of the designer (the variables designer, the overview map, etc.&amp;#160; This will react just the same as if you were building the workflow in VS.&amp;#160; &lt;/p&gt;

&lt;p&gt;Let’s add the property grid by adding the following two lines:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Grid.SetColumn(wd.PropertyInspectorView, 2);
grid1.Children.Add(wd.PropertyInspectorView);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This will let us see the property grid (so things get a little more interesting).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_3.png" width="381" height="315" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So, we’re able to display the workflow and interact with it, but we probably also want to have a constrained authoring experience (not just editing), so that comes in the form of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.activities.design.toolboxcontrol(VS.100).aspx"&gt;ToolboxControl&lt;/a&gt;.&amp;#160; For the sake of this blog post, we’ll use this in XAML, but we certainly can code against it imperatively as well.&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt; &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BlogPostRehosting.Window1&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:sad&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System.Activities.Design;assembly=System.Activities.Design&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;xmlns:sys&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&lt;/span&gt;
        &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Window1&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;664&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;831&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sys:String&lt;/span&gt; &lt;span class="attr"&gt;x:Key&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AssemblyName&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sys:String&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window.Resources&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;grid1&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ColumnDefinition&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2*&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl.Categories&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxCategoryItemsCollection&lt;/span&gt; &lt;span class="attr"&gt;CategoryName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Basic&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Sequence&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.If&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Parallel&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.WriteLine&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxItemWrapper&lt;/span&gt; &lt;span class="attr"&gt;AssemblyName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{StaticResource AssemblyName}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ToolName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;System.Activities.Statements.Persist&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxCategoryItemsCollection&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl.Categories&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;sad:ToolboxControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This lets me specify the items I want to allow a user to drop.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_10.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehostingPart2_F7F5/image_thumb_4.png" width="627" height="522" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The thing that is interesting to point out here is that we’ve built a full featured, constrained editor (with things like copy paste, undo/redo, etc) with not too much code.&lt;/p&gt;

&lt;p&gt;Next time, we’ll get into to doing some more interesting bits as well to interact with the item being edited, serialize to XAML, and explore the editing context some more.&amp;#160; Let me know what you think!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9769899" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category></item><item><title>Introduction to WF Designer Rehosting (Part 1)</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/17/introduction-to-wf-designer-rehosting-part-1.aspx</link><pubDate>Wed, 17 Jun 2009 03:31:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9763452</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9763452.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9763452</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;standard beta disclaimer.&amp;#160; This is written against the beta1 API’s.&amp;#160; If this is 2014, the bits will look different.&amp;#160; When the bits update, I will make sure to have a new post that updates these (or points to SDK samples that do)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In WF3, we allowed our customers to rehost the WF designer inside their own applications.&amp;#160; This has many &lt;a href="http://msdn.microsoft.com/en-us/library/cc835242.aspx"&gt;reasons&lt;/a&gt;, usually about monitoring a workflow or allowing an end user to customize a constrained workflow (visual construction of an approval process, for instance). This &lt;a href="http://msdn.microsoft.com/en-us/library/aa480213.aspx"&gt;article&lt;/a&gt; became the gold standard for writing rehosted applications.&amp;#160; As we were planning our work for the WF4 designer, this was certainly a scenario we considered, and one we wanted to make easier.&amp;#160; &lt;/p&gt;  &lt;p&gt;This post consists of a few parts&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Designer architecture – introduce the pieces, parts and terms we’ll use throughout &lt;/li&gt;    &lt;li&gt;Simple rehosting – getting it up and running &lt;/li&gt;    &lt;li&gt;What to do next &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Designer Architecture&lt;/h1&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehosting_ECB0/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroductiontoWFDesignerRehosting_ECB0/image_thumb.png" width="639" height="284" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There are a few key components here&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Source      &lt;ul&gt;       &lt;li&gt;In VS, this is xaml, but this represents the durable storage of the “thing” we are editing &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Instance      &lt;ul&gt;       &lt;li&gt;This is the in memory representation of the item being edited.&amp;#160; In vs2010 for the WF designer, this is a hierarchy of System.Activities instances (an object tree) &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Model Item Tree      &lt;ul&gt;       &lt;li&gt;This serves as an intermediary between the view and the instance, and is responsible for change notification and tracking things like undo state &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Design View      &lt;ul&gt;       &lt;li&gt;This is the visual editing view that is surfaced to the user, the designers are written using WPF, which uses plain old data binding in order to wire up to the underlying model items (which represent the data being edited). &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Metadata Store      &lt;ul&gt;       &lt;li&gt;This is a mapping between type and designers, an attribute table for lack of a better term.&amp;#160; This is how we know what designer to use for what type &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I’ll go into more detail about these pieces and parts in future posts as well, but this is the mental model of the things I will be talking about as we go through the designer. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Stay tuned, part 2 will come tomorrow!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9763452" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/rehosting/default.aspx">rehosting</category></item><item><title>Types, Metatypes and Bears, Oh my!</title><link>http://blogs.msdn.com/mwinkle/archive/2009/06/10/types-metatypes-and-bears-oh-my.aspx</link><pubDate>Tue, 09 Jun 2009 23:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9718703</guid><dc:creator>mwinkle</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9718703.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9718703</wfw:commentRss><description>&lt;H2&gt;&lt;STRONG&gt;***** UPDATE: Please see &lt;A href="http://blogs.msdn.com/mwinkle/archive/2009/10/23/types-metatypes-and-bears-redux.aspx" mce_href="http://blogs.msdn.com/mwinkle/archive/2009/10/23/types-metatypes-and-bears-redux.aspx"&gt;this post&lt;/A&gt; for how these features and functionality work in Beta2 *****&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="Polar Bear" href="http://www.flickr.com/photos/21208051@N00/108149173/" mce_href="http://www.flickr.com/photos/21208051@N00/108149173/"&gt;&lt;IMG border=0 alt="Polar Bear" src="http://static.flickr.com/52/108149173_990037d136.jpg" mce_src="http://static.flickr.com/52/108149173_990037d136.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;image courtesy of flickr user &lt;A href="http://www.flickr.com/photos/chodhound/108149173/in/set-72057594075424977/" mce_href="http://www.flickr.com/photos/chodhound/108149173/in/set-72057594075424977/"&gt;chodhound&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This post comes about after a little conversation on the &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b07e86c6-c000-4e77-bb56-9600ecf03144" mce_href="http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b07e86c6-c000-4e77-bb56-9600ecf03144"&gt;forums&lt;/A&gt; where I was talking about using the xaml stack save and load objects. &lt;/P&gt;
&lt;P&gt;Here’s what I said:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Bob&amp;nbsp; (it's a little late in Seattle, so I don't have a code editor handy, so there may be some minor errors below), &lt;BR&gt;If you want to serialize any object graph to xaml, simply look at the XamlServices.Save() api that's in System.Xaml.&amp;nbsp; I'm sure there are a few SDK samples around that as well.&amp;nbsp; It takes in a file name to output to, a text writer or a stream, so you get to pick your poison for destination.&amp;nbsp; Similarly, if you want to get an object graph deserialized from Xaml, you can just use XamlServices.Load() again, with overloads for files, streams, text, xml, and xaml readers. &lt;BR&gt;To see this API, just do something like&lt;/P&gt;&lt;PRE&gt;Sequence s = new Sequence { Activities = { new Persist(), new Persist() } };
XamlServices.Save(fileNameVar, s);&lt;/PRE&gt;
&lt;P&gt;If you want to read, basically do the reverse. &lt;BR&gt;Save and Load are convinient helper functions to operate on the whole of the doc, there Xaml stack surfaces much more programmability and has a nice node stream style API that lets you plug in while nodes are being read and written. &lt;BR&gt;Now, if you want to deserialize a Xaml file that contains an x:Class directive, you are going to need to do a bit more work (and it depends what you want to serialize to or from).&amp;nbsp; I'll try to blog about that in the next week or so.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now, I want to take a little bit of time to explain the last part.&lt;/P&gt;
&lt;P&gt;A convenient way to think about XAML is a way to write down objects, really, instances of objects.&amp;nbsp; That said I am not limited to writing down just instances, I can actually write down type definitions as well.&amp;nbsp; I do this using the x:Class attribute.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Consider the following XAML snippet&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;Activity x:Class="foo" ...&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;This is roughly equivalent to the following C#&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; foo : Activity
{
...&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Now, “normally” what happens with XAML like this in .xaml files is that it is used in a VS project and it is set up so that there is a build task who has the job of generating a type from that XAML so that you can use that type subsequently in your application.&amp;nbsp; This works basically the same way for WPF as well as WF. &lt;/P&gt;
&lt;P&gt;However, if you think about trying simply deserialize this, it’s a little confusing what this will actually deserialize to.&amp;nbsp; This is a type definition, so if you simply try to pass it to XamlServices.Load(), you will encounter an exception:&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Consolas&gt;Error System.Xaml.XamlObjectWriterException: No matching constructor found on type System.Activities.Activity. You can use the Arguments or FactoryMethod direct ives to construct this type. ---&amp;gt; System.MissingMethodException: No default constructor found for type System.Activities.Activity. You can use the Arguments or FactoryMethod directives to construct this type. &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Xaml.Runtime.ClrObjectRuntime.DefaultCtorXamlActivator.EnsureConstructorDelegate(XamlType xamlType) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Xaml.Runtime.ClrObjectRuntime.DefaultCtorXamlActivator.CreateInstance(XamlType xamlType) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args) &lt;BR&gt;&amp;nbsp;&amp;nbsp; --- End of inner exception stack trace ---&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So, if we want to deserialize that, we need to ask the question first: “Why do we want to deserialize it?”&lt;/P&gt;
&lt;H2&gt;Deserialize to Execute&lt;/H2&gt;
&lt;P&gt;If we want to simply use the activity we’ve created and have it execute, we have a special type, &lt;A href="http://msdn.microsoft.com/en-us/library/system.activities.dynamicactivity(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.activities.dynamicactivity(VS.100).aspx"&gt;DynamicActivity&lt;/A&gt;.&amp;nbsp; DynamicActivity lets you execute the activity, and rather than creating a type for it, will allow you to pass in the arguments in the typical Dictionary&amp;lt;string,object&amp;gt; way that we are used to.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Imagine a xaml file, just sitting on disk somewhere that looks like this (a workflow that concats two strings):&amp;nbsp; &lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Activity&lt;/SPAN&gt; &lt;SPAN class=attr&gt;mc:Ignorable&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt;
    &lt;SPAN class=attr&gt;x:Class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="WorkflowConsoleApplication1.Sequence1"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/netfx/2009/xaml/activities/design"&lt;/SPAN&gt;
     &lt;SPAN class=attr&gt;xmlns:__Sequence1&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="clr-namespace:WorkflowConsoleApplication1;"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:mc&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:p&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/netfx/2009/xaml/activities"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:x&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Members&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Property&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="argument1"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="p:InArgument(x:String)"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Property&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="argument2"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="p:InArgument(x:String)"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Members&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Sequence&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:WriteLine&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;[argument1 + " " + argument2]&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:WriteLine&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Sequence&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Activity&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;The code for this is the following:&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; o = WorkflowXamlServices.Load(File.OpenRead(&lt;SPAN class=str&gt;"Sequence1.xaml"&lt;/SPAN&gt;));
Console.WriteLine(&lt;SPAN class=str&gt;"Success {0}"&lt;/SPAN&gt;, o.GetType());
DynamicActivity da = o &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; DynamicActivity;da.Properties.ToList().ForEach(ap =&amp;gt; Console.WriteLine(&lt;SPAN class=str&gt;"argument: {0}"&lt;/SPAN&gt;, ap.Name));
WorkflowInvoker.Invoke(da, &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Dictionary&amp;lt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt;&amp;gt; { { &lt;SPAN class=str&gt;"argument1"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt; }, { &lt;SPAN class=str&gt;"argument2"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"bar"&lt;/SPAN&gt; } });&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;H2&gt;Deserialize to “Design”&lt;/H2&gt;
&lt;P&gt;At design time, we have an even more interesting problem.&amp;nbsp; Our designer is an instance editor, and, as such, it must always edit an instance of “something”.&amp;nbsp; In our case, we actually do some work in our design time xaml reader and writer to deserialize into a metatype, an instance of a type whose sole purpose in life is to describe the activity.&amp;nbsp; In Beta1, this is called &lt;A href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.activityschematype(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.activityschematype(VS.100).aspx"&gt;ActivitySchemaType&lt;/A&gt;.&amp;nbsp; ActivitySchemaType simply models the type structure of an activity, complete with properties, etc&amp;nbsp; If you want to construct an instance of an ActivitySchemaType in code, you can, and then you could use the &lt;A href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.designtimexamlwriter(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.activities.design.xaml.designtimexamlwriter(VS.100).aspx"&gt;DesignTimeXamlWriter&lt;/A&gt; in order to properly serialize out to an Activity x:class xaml file.&amp;nbsp; The following code works on an ActivitySchemaType in memory and then serializes it:&lt;/P&gt;&lt;PRE class=csharpcode&gt;XamlSchemaContext xsc = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; XamlSchemaContext();
ActivitySchemaType ast = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ActivitySchemaType()
{
    Name = &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt;,
    Members = 
     {
        &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Property { Name=&lt;SPAN class=str&gt;"argument1"&lt;/SPAN&gt;, Type = xsc.GetXamlType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(InArgument&amp;lt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;&amp;gt;)) }

     },
    Body = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Sequence { Activities = { &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist(), &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist() } }
};
StringBuilder sb = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; StringBuilder();

DesignTimeXamlWriter dtxw = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; DesignTimeXamlWriter(
    &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; StringWriter(sb),
    xsc, &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"bar.rock"&lt;/SPAN&gt;);

XamlServices.Save(dtxw, ast);
Console.WriteLine(&lt;SPAN class=str&gt;"you wrote:"&lt;/SPAN&gt;);
ConsoleColor old = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(sb.ToString());
Console.ForegroundColor = old;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;This is what the output looks like:&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Activity&lt;/SPAN&gt; &lt;SPAN class=attr&gt;mc:Ignorable&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt;
     &lt;SPAN class=attr&gt;x:Class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="foo"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/netfx/2009/xaml/activities/design"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:__foo&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="clr-namespace:bar.rock;"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:mc&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:p&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/netfx/2009/xaml/activities"&lt;/SPAN&gt; 
     &lt;SPAN class=attr&gt;xmlns:x&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Members&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Property&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="argument1"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="p:InArgument(x:String)"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;x:Members&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Sequence&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Persist&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Persist&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Sequence&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;p:Activity&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;If you want to read in from this, you have to do a little bit of trickery with the designer as DesignTimeXamlReader is not a public type in beta1.&amp;nbsp; &lt;/P&gt;&lt;PRE class=csharpcode&gt;WorkflowDesigner wd = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WorkflowDesigner();
wd.Load(&lt;SPAN class=str&gt;"Sequence1.xaml"&lt;/SPAN&gt;);
&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; obj = wd.Context.Services.GetService&amp;lt;ModelService&amp;gt;().Root.GetCurrentValue();
Console.WriteLine(&lt;SPAN class=str&gt;"object read type: {0}"&lt;/SPAN&gt;, obj.GetType());
ActivitySchemaType schemaType = obj &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; ActivitySchemaType;
Console.WriteLine(&lt;SPAN class=str&gt;"schema type name: {0}"&lt;/SPAN&gt;, schemaType.Name);
schemaType.Members.ToList().ForEach(p =&amp;gt; Console.WriteLine(&lt;SPAN class=str&gt;"argument: {0}, type: {1}"&lt;/SPAN&gt;, p.Name, p.Type));&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;That wraps up our tour of the ways to read (and write)&amp;nbsp; &amp;lt;Activity x:Class xaml&lt;/P&gt;
&lt;P&gt;Here’s the full text of the little program I put together to execute this, also make sure to drop a sequence1.xaml into your execution directory if you want this to not throw :-) &lt;/P&gt;
&lt;HR&gt;

&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Collections.Generic;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Linq;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Text;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Xaml;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Activities.Statements;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Activities;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.IO;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Activities.Design.Xaml;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Windows.Markup;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Xml;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Activities.Design;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Activities.Design.Services;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;namespace&lt;/SPAN&gt; ConsoleApplication2&lt;/PRE&gt;&lt;PRE&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; Program&lt;/PRE&gt;&lt;PRE&gt;    {&lt;/PRE&gt;&lt;PRE class=alt&gt;        [STAThread()]&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Main(&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;[] args)&lt;/PRE&gt;&lt;PRE class=alt&gt;        {&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt; doStuff = &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;            Guid g = Guid.NewGuid();&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;while&lt;/SPAN&gt; (doStuff)&lt;/PRE&gt;&lt;PRE class=alt&gt;            {&lt;/PRE&gt;&lt;PRE&gt;                Console.WriteLine();&lt;/PRE&gt;&lt;PRE class=alt&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"What do you want to do?"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"    read [x]:class xaml with XamlServices"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"    read x:class xaml with W[o]rkflowXamlServices"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"    [w]rite an ActivitySchemaType"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"    r[e]ad an ActivitySchemaType"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;                Console.WriteLine(&lt;SPAN class=str&gt;"    [q]uit"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;                Console.WriteLine();&lt;/PRE&gt;&lt;PRE&gt;                &lt;SPAN class=kwrd&gt;char&lt;/SPAN&gt; c = Console.ReadKey(&lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;).KeyChar;&lt;/PRE&gt;&lt;PRE class=alt&gt;                &lt;SPAN class=kwrd&gt;switch&lt;/SPAN&gt; (c)&lt;/PRE&gt;&lt;PRE&gt;                {&lt;/PRE&gt;&lt;PRE class=alt&gt;                    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;'w'&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE&gt;                        XamlSchemaContext xsc = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; XamlSchemaContext();&lt;/PRE&gt;&lt;PRE class=alt&gt;                        ActivitySchemaType ast = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ActivitySchemaType()&lt;/PRE&gt;&lt;PRE&gt;                        {&lt;/PRE&gt;&lt;PRE class=alt&gt;                            Name = &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt;,&lt;/PRE&gt;&lt;PRE&gt;                            Members = &lt;/PRE&gt;&lt;PRE class=alt&gt;                             {&lt;/PRE&gt;&lt;PRE&gt;                                &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Property { Name=&lt;SPAN class=str&gt;"argument1"&lt;/SPAN&gt;, Type = xsc.GetXamlType(&lt;SPAN class=kwrd&gt;typeof&lt;/SPAN&gt;(InArgument&amp;lt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;&amp;gt;)) }&lt;/PRE&gt;&lt;PRE class=alt&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;                             },&lt;/PRE&gt;&lt;PRE class=alt&gt;                            Body = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Sequence { Activities = { &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist(), &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist() } }&lt;/PRE&gt;&lt;PRE&gt;                        };&lt;/PRE&gt;&lt;PRE class=alt&gt;                        StringBuilder sb = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; StringBuilder();&lt;/PRE&gt;&lt;PRE&gt;                        &lt;/PRE&gt;&lt;PRE class=alt&gt;                        DesignTimeXamlWriter dtxw = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; DesignTimeXamlWriter(&lt;/PRE&gt;&lt;PRE&gt;                            &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; StringWriter(sb),&lt;/PRE&gt;&lt;PRE class=alt&gt;                            xsc, &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"bar.rock"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;                        &lt;/PRE&gt;&lt;PRE class=alt&gt;                        XamlServices.Save(dtxw, ast);&lt;/PRE&gt;&lt;PRE&gt;                        Console.WriteLine(&lt;SPAN class=str&gt;"you wrote:"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;                        ConsoleColor old = Console.ForegroundColor;&lt;/PRE&gt;&lt;PRE&gt;                        Console.ForegroundColor = ConsoleColor.DarkGray;&lt;/PRE&gt;&lt;PRE class=alt&gt;                        Console.WriteLine(sb.ToString());&lt;/PRE&gt;&lt;PRE&gt;                        Console.ForegroundColor = old;&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;                    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;'x'&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE&gt;                        &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;                        {&lt;/PRE&gt;&lt;PRE&gt;                            &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; o = XamlServices.Load(File.OpenRead(&lt;SPAN class=str&gt;"Sequence1.xaml"&lt;/SPAN&gt;));&lt;/PRE&gt;&lt;PRE class=alt&gt;                            Console.WriteLine(&lt;SPAN class=str&gt;"Success{0}"&lt;/SPAN&gt;, o.GetType());&lt;/PRE&gt;&lt;PRE&gt;                        }&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; (Exception ex)&lt;/PRE&gt;&lt;PRE&gt;                        {&lt;/PRE&gt;&lt;PRE class=alt&gt;                            Console.WriteLine(&lt;SPAN class=str&gt;"Error {0}"&lt;/SPAN&gt;, ex);&lt;/PRE&gt;&lt;PRE&gt;                        }&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;                    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;'o'&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;try&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;                        {&lt;/PRE&gt;&lt;PRE class=alt&gt;                            &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; o = WorkflowXamlServices.Load(File.OpenRead(&lt;SPAN class=str&gt;"Sequence1.xaml"&lt;/SPAN&gt;));&lt;/PRE&gt;&lt;PRE&gt;                            Console.WriteLine(&lt;SPAN class=str&gt;"Success {0}"&lt;/SPAN&gt;, o.GetType());&lt;/PRE&gt;&lt;PRE class=alt&gt;                            DynamicActivity da = o &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; DynamicActivity;&lt;/PRE&gt;&lt;PRE&gt;                            da.Properties.ToList().ForEach(ap =&amp;gt; Console.WriteLine(&lt;SPAN class=str&gt;"argument: {0}"&lt;/SPAN&gt;, ap.Name));&lt;/PRE&gt;&lt;PRE class=alt&gt;                            WorkflowInvoker.Invoke(da, &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Dictionary&amp;lt;&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt;&amp;gt; { { &lt;SPAN class=str&gt;"argument1"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"foo"&lt;/SPAN&gt; }, { &lt;SPAN class=str&gt;"argument2"&lt;/SPAN&gt;, &lt;SPAN class=str&gt;"bar"&lt;/SPAN&gt; } });&lt;/PRE&gt;&lt;PRE&gt;                        }&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;catch&lt;/SPAN&gt; (Exception ex)&lt;/PRE&gt;&lt;PRE&gt;                        {&lt;/PRE&gt;&lt;PRE class=alt&gt;                            Console.WriteLine(&lt;SPAN class=str&gt;"Error {0}"&lt;/SPAN&gt;, ex);&lt;/PRE&gt;&lt;PRE&gt;                        }&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;                    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;'e'&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE class=alt&gt;                        WorkflowDesigner wd = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WorkflowDesigner();&lt;/PRE&gt;&lt;PRE&gt;                        wd.Load(&lt;SPAN class=str&gt;"Sequence1.xaml"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; obj = wd.Context.Services.GetService&amp;lt;ModelService&amp;gt;().Root.GetCurrentValue();&lt;/PRE&gt;&lt;PRE&gt;                        Console.WriteLine(&lt;SPAN class=str&gt;"object read type: {0}"&lt;/SPAN&gt;, obj.GetType());&lt;/PRE&gt;&lt;PRE class=alt&gt;                        ActivitySchemaType schemaType = obj &lt;SPAN class=kwrd&gt;as&lt;/SPAN&gt; ActivitySchemaType;&lt;/PRE&gt;&lt;PRE&gt;                        Console.WriteLine(&lt;SPAN class=str&gt;"schema type name: {0}"&lt;/SPAN&gt;, schemaType.Name);&lt;/PRE&gt;&lt;PRE class=alt&gt;                        schemaType.Members.ToList().ForEach(p =&amp;gt; Console.WriteLine(&lt;SPAN class=str&gt;"argument: {0}, type: {1}"&lt;/SPAN&gt;, p.Name, p.Type));&lt;/PRE&gt;&lt;PRE&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;                    &lt;SPAN class=kwrd&gt;case&lt;/SPAN&gt; &lt;SPAN class=str&gt;'q'&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE&gt;                        doStuff = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;                    &lt;SPAN class=kwrd&gt;default&lt;/SPAN&gt;:&lt;/PRE&gt;&lt;PRE&gt;                        &lt;SPAN class=kwrd&gt;break&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;                }&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;            }&lt;/PRE&gt;&lt;PRE&gt;            Console.WriteLine(&lt;SPAN class=str&gt;"All done"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;            Console.ReadLine();&lt;/PRE&gt;&lt;PRE&gt;        }&lt;/PRE&gt;&lt;PRE class=alt&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;static&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; CreateWfObject()&lt;/PRE&gt;&lt;PRE class=alt&gt;        {&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Sequence { Activities = { &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist(), &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Persist() } };&lt;/PRE&gt;&lt;PRE class=alt&gt;        }&lt;/PRE&gt;&lt;PRE&gt;    }&lt;/PRE&gt;&lt;PRE class=alt&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9718703" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/xaml/default.aspx">xaml</category></item><item><title>Introducing the WF4 Designer</title><link>http://blogs.msdn.com/mwinkle/archive/2009/05/20/introducing-the-wf4-designer.aspx</link><pubDate>Wed, 20 May 2009 23:27:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632833</guid><dc:creator>mwinkle</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/mwinkle/comments/9632833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mwinkle/commentrss.aspx?PostID=9632833</wfw:commentRss><description>&lt;p&gt;&lt;em&gt;// standard disclaimer applies, this is based on the released Beta 1 bits, things are subject to change, if you are reading this in 2012, things may be, look, smell, work differently.&amp;#160; That said, if it’s 2012 and you’re reading this, drop me a line and let me know how you found this!&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As you might have heard, &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;Beta1 of VS is out the door, and available to the public sometime today&lt;/a&gt;.&amp;#160; As you may know we’ve done a bunch of work for WF4, and I wanted to give a quick, high level overview of the designer.&amp;#160; &lt;a href="http://blogs.msdn.com/endpoint/archive/2009/05/20/vs-2010-and-net-framework-4-0-beta1-available-for-download.aspx"&gt;Here’s a good overview&lt;/a&gt; for the new WF bits all up.&lt;/p&gt;  &lt;p&gt;First, let’s start with your existing WF projects.&amp;#160; What happens if I want to create a 3.5 workflow?&amp;#160; We’re still shipping that designer, in fact, let’s start there on our tour.&amp;#160; This shows of a feature of VS that’s&amp;#160; pretty cool, multitargeting.&amp;#160; &lt;/p&gt;  &lt;p&gt;Click New Project&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb.png" width="596" height="429" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice the “Framework Version” dropdown in the upper right hand corner. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_28.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_13.png" width="409" height="186" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This tells VS which version of the framework you would like the project you are creating to target.&amp;#160; This means you can still work on your existing projects in VS 2010 without upgrading your app to the new framework.&amp;#160; Let’s pick something that’s not 4.0, namely 3.5.&amp;#160; You’ll note that the templates may have updated a bit, select Workflow from the left hand tree view and see what shows up.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_1.png" width="604" height="446" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There isn’t anything magical about what happens next, you will now see the 3.5 designer inside of VS2010.&amp;#160; You’re able to build, create, edit and update your existing WF applications.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_2.png" width="424" height="523" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Let’s move on and switch over to a 4.0 workflow.&lt;/p&gt;  &lt;p&gt;Create a new project and select 4.0&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_3.png" width="529" height="389" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Create a new WF Sequential Console application and name it “SampleProject”.&amp;#160; Click Ok.&lt;/p&gt;  &lt;p&gt;We’ll do a little bit of work here, but you will shortly see the WF 4.0 designer.&amp;#160; It looks a little different from the 3.x days, we’ve taken this time to update the designer pretty substantially.&amp;#160; We’ve built it on top of WPF, which opens up the doors for us to do a lot of interesting things.&amp;#160; If you were at PDC and saw any Quadrant demos, you might think that these look similar. We haven’t locked on the final look and feel yet, so expect to see some additional changes there, but submit your feedback early and often, we want to know what you think.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_4.png" width="464" height="575" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Let’s drop some activities into our sequence and see what’s there to be seen.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_5.png" width="143" height="561" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We’ve categorized the toolbox into functional groupings for the key activities.&amp;#160; We heard a lot of feedback that it was tough to know what to use when, so we wanted to provide a little more help with some richer default categories.&amp;#160; Add an Assign activity, a WriteLine activity and a Delay activity to the canvas by clicking and dragging over the to the sequence designer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_6.png" width="223" height="305" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You’ll note that we’ve now got some icons on each activity indicating something is not correct.&amp;#160; This is a result of the validation executing and returning details about what is wrong.&amp;#160; Think of these as the little red squiggles that show up when you spell something wrong.&amp;#160; You can hover over the icon to see what’s wrong&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_7.png" width="467" height="110" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can also see that errors will bubble up to their container, so hovering over sequence will tell you that there is a problem with the child activities.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_8.png" width="445" height="290" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;What if I have a big workflow, and what if I want to see a more detailed listing of errors?&amp;#160; Open up the Error View and you will see the validation results are also displayed here.&amp;#160; You’ll note there is some minor formatting weirdness.&amp;#160; This is a bug that we fixed but not in time for the Beta1 release.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_9.png" width="650" height="178" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, let’s actually wire up some data to this workflow.&amp;#160; WF4 has done a lot of work to be much more crisp about the way we think about data within the execution environment of a workflow. We divide the world into two types of data, Arguments, and Variables.&amp;#160; If you mentally map these to the way you write a method in code (parameters, and state internal to the method), you are one the right track.&amp;#160; Arguments determine the shape of an activity, what goes in, what goes out.&amp;#160; Variables allocate storage within the context of an activities execution.&amp;#160; The neat thing about variables, once the containing activity is done, we can get rid of the variables, as our workflow no longer needs them (note, we pass the important data in and out through the arguments).&amp;#160; To do this, we have two special designers on the canvas that contain information about the arguments and variables in your workflow &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_42.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_20.png" width="631" height="245" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;First, let’s click on the Argument designer and pass in some data.&amp;#160; &lt;/p&gt;  &lt;p&gt;Arguments consist of a few important elements&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name &lt;/li&gt;    &lt;li&gt;Type &lt;/li&gt;    &lt;li&gt;Direction &lt;/li&gt;    &lt;li&gt;Default Value (Optional) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_10.png" width="436" height="298" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Most of these are self explanatory, with the one exception being the Direction.&amp;#160; You’ll note that this has In, Out and Property.&amp;#160; Now, when you are editing the arguments, you are actually editing the properties of the underlying type you are creating (I’ll explain more about this in a future post).&amp;#160; A more appropriate name might be “Property Editor” but the vast majority of what you’ll be creating with it is arguments.&amp;#160; Anyway, If you select In or Out, this basically wraps the type T in an InArgument, so it becomes a property of type InArgument&amp;lt;T&amp;gt;.&amp;#160; We just provide a bit of a shorthand so you don’t always have to pick InArgument as the type.&amp;#160; The default value takes an expression, but in this case, we won’t be using it.&lt;/p&gt;  &lt;p&gt;Let’s go ahead and add an argument of type TimeSpan named DelayTime.&amp;#160; You’ll need to select browse for types and then search for the TimeSpan&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_24.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_11.png" width="484" height="557" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Variables are similar, but slightly different, variables have a few important elements:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name &lt;/li&gt;    &lt;li&gt;Type &lt;/li&gt;    &lt;li&gt;Scope &lt;/li&gt;    &lt;li&gt;Default Value (Optional) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Remember earlier, I mentioned that variable is part of an activity, this is what Scope refers to.&amp;#160; Variables will only show up to be the scope of the selected activity, so if you don’t see any, make sure to select the Sequence, and then you will be able to add a variable.&amp;#160; Let’s add new variable, named StringToPrint, of type String.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_12.png" width="431" height="297" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now let’s do something with these in the workflow.&amp;#160; One thing I’m particularly happy with that we’ve done on the designer side of things is to enable people to build activity designers more easily.&amp;#160; There are lots of times where you have activities that have just a few key properties that need to be set, and you’d like to be able to see that “at a glance”&amp;#160; The assign designer is like that.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_30.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_14.png" width="267" height="102" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, let’s dig into expressions.&amp;#160; One big piece of feedback from 3.0 was that people really wanted richer binding experiences.&amp;#160; You see this as well with the WPF data binding .&amp;#160; We’ve taken it to the next level, and allow any expression to be expressed as a set of activities.&amp;#160; What this means is that we do have to “compile” textual expressions into a tree of activities, and this is one of the reasons we use VB to build expressions.&amp;#160; In the fullness of time, other languages will come on board. But how to use it, let’s see.&amp;#160; Click on the “To” text box on the Assign activity.&amp;#160; You will see a brief change of the text box, and then you will be in a VB Expression Editor, or what we’ve come to refer to as “The Expression Text Box” or ETB.&amp;#160; Start typing S, and already you will see intellisense begin to scope down the choices.&amp;#160; This will pick up all of the variables and arguments in scope.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_32.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_15.png" width="330" height="314" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the right side, we won’t use any of the passed in arguments, we’ll show off a richer expression.&amp;#160;&amp;#160; Now, the space on the right side of the designer is kind of tight for something lengthy, so go to the property grid and click on the “…” button for the Value property &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_34.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_16.png" width="580" height="404" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;String&lt;/span&gt;.Format(&lt;span class="str"&gt;&amp;quot;Someone wants to wait {0} seconds&amp;quot;&lt;/span&gt;, TimeToWait.TotalSeconds)&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This just touches the surface of what is possible with expressions in WF4, we can really get&amp;#160; much richer expressions (3.x expressions are similar to WPF data binding, they are really an “object” + “target” structure).&lt;/p&gt;

&lt;p&gt;Not everything makes it to the canvas of the designer surface, and for that, we have the property grid.&amp;#160; If you’ve used the WPF designer in VS2008, this should look pretty familiar to you.&amp;#160; Select the delay activity, and use the property grid to set the duration property to the InArgument you created above.&amp;#160; This experience is similar, with the ETB embedded into the property grid for arguments. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Finally, repeat with the WriteLine and bind to the StringToPrint variable.&lt;/p&gt;

&lt;h1&gt;Navigating the Workflow&lt;/h1&gt;

&lt;p&gt;There are two different things that we have to help navigating the workflow, our breadcrumb bar at the top and the overview map (which appears as the “Mini Map” in the beta).&amp;#160; Let’s look at the overview map.&amp;#160; This gives you a view of the entire workflow and the ability to quickly scrub and scroll across it.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_36.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_17.png" width="337" height="531" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Finally, across the top we display our breadcrumbs which are useful when you have a highly nested workflow.&amp;#160; Double click on one of the activities, and you should see the designer “drill into” that activity.&amp;#160; Now notice the breadcrumb bar, it displays where you have been, and by clicking you can navigate back up the hierarchy.&amp;#160; In beta1, we have a pretty aggressive breadcrumb behavior, and so you see “collapsed in place” as the default for many of our designers.&amp;#160; We’re probably going to relax that a bit in upcoming milestones to reduce clicking and provide a better overview of the workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_40.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_19.png" width="402" height="530" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Finally, there may be times where we don’t want to have a designer view, but would rather see the XAML.&amp;#160; To get there, just right click on the file and ask to “View Code”&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_38.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_18.png" width="236" height="362" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This will currently ask you if you are sure that you want to close the designer, and you will then see the XAML displayed in the XML editor.&amp;#160; For the workflow we just created, this is what it looks like:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt; &lt;span class="attr"&gt;mc:Ignorable&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;     &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WorkflowConsoleApplication1.Sequence1&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities/design&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:__Sequence1&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:WorkflowConsoleApplication1;&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:mc&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:p&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/netfx/2009/xaml/activities&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:s&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System;assembly=mscorlib&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:sad&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;clr-namespace:System.Activities.Debugger;assembly=System.Activities&amp;quot;&lt;/span&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;     &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;x:Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TimeToWait&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;p:InArgument(s:TimeSpan)&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;x:Members&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;__Sequence1:Sequence1.TimeToWait&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;s:TimeSpan&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[TimeSpan.FromSeconds(10)]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;__Sequence1:Sequence1.TimeToWait&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Sequence.Variables&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Variable&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;StringToPrint&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence.Variables&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign.To&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:OutArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            [StringToPrint]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:OutArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign.To&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Assign.Value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt; &lt;span class="attr"&gt;x:TypeArguments&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;x:String&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                  [String.Format(&amp;quot;Someone wants to wait {0} seconds&amp;quot;, TimeToWait.TotalSeconds)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:InArgument&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign.Value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Assign&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:Delay&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[TimeToWait]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Delay&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;[StringToPrint]&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:WriteLine&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Sequence&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p:Activity&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Executing the Workflow&lt;/h1&gt;

&lt;p&gt;Inside the project you will see the Program.cs to execute the workflow, let’s take a look at that. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; WorkflowConsoleApplication1&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Threading;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Activities.Statements;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            AutoResetEvent syncEvent = &lt;span class="kwrd"&gt;new&lt;/span&gt; AutoResetEvent(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            WorkflowInstance myInstance =&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowInstance(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence1(),&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                    {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                        {&lt;span class="str"&gt;&amp;quot;TimeToWait&amp;quot;&lt;/span&gt;, TimeSpan.FromSeconds(3.5) }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    );&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;            myInstance.OnCompleted = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowCompletedEventArgs e) { syncEvent.Set(); };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            myInstance.OnUnhandledException = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowUnhandledExceptionEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                Console.WriteLine(e.UnhandledException.ToString());&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; UnhandledExceptionAction.Terminate;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            myInstance.OnAborted = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(WorkflowAbortedEventArgs e)&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            {&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                Console.WriteLine(e.Reason);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;                syncEvent.Set();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            };&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;            myInstance.Run();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            syncEvent.WaitOne();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press &amp;lt;Enter&amp;gt; to exit&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    }&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;This is the standard program.cs template with two modifications.&amp;#160; The first is passing data into the workflow, indicated by the dictionary we create to pass into the WorkflowInstance.&amp;#160; This should look familiar if you have used WF in the past. &lt;/p&gt;

&lt;pre class="csharpcode"&gt; WorkflowInstance myInstance =
                &lt;span class="kwrd"&gt;new&lt;/span&gt; WorkflowInstance(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sequence1(),
                    &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt;
                    {
                        {&lt;span class="str"&gt;&amp;quot;TimeToWait&amp;quot;&lt;/span&gt;, TimeSpan.FromSeconds(3.5) }
                    }
                 );&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The second is a break at the end to keep our console window open (lines 41 and 42).&amp;#160; Hitting F5 from our project results in the following output (as expected).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_44.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/mwinkle/WindowsLiveWriter/IntroducingtheWF4Designer_12E40/image_thumb_21.png" width="550" height="381" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This concludes our brief tour through the new WF designer.&amp;#160; I’ll be talking a lot more in upcoming days about some of the more programmatic aspects of it and how it’s put together. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9632833" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf/default.aspx">wf</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vNext/default.aspx">vNext</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/vs10/default.aspx">vs10</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/wf4/default.aspx">wf4</category><category domain="http://blogs.msdn.com/mwinkle/archive/tags/beta/default.aspx">beta</category></item></channel></rss>