Geeks With Blogs
Jennifer Zouak JENNIFER · ZOUAK's · BizTalk · and · .NET · column

I finally got an example working where I am using a pure XAML (no code) workflow definition and also using a base class. This took a bit of research and filling in the blanks. I was surprised that Visual Studio doesn't seem to support the XAML-only stuff... sigh. And when I got is working, the designer refused to display it, so I have to stick to the XML Editor going forwards. (I haven't checked the 3.5 fixes yet, xfingers!)

First I created the workflow custom base class as a csharp class, I created my custom activity. Next, in a different project, I let Visual Studio create a XAML file for me (it is important to do the actual workflow definition in a different project, do not optimize this). Then I edited it, and deleted the code behind. Here is the summary of the manual editing steps:

  • Remove the x:Class attribute
  • Change the initial tag from the current workflow name to the name of your base workflow class. Ensure you add a namespace tag i.e. "ns0"
  • define the namespace instead of using http instead using clr-namespace (see below) and after that provide the fully qualified namespace and assembly for the workflow base class. You need not apply a strong name, but that is what I usually do.
<ns0:MyBaseWorkflow x:Name="workflow1" InProp1="{x:Null}"
  xmlns:ns0="clr-namespace:My.Workflow.Activities;Assembly=My.LeadImport.Workflow.Activities, Version=, Culture=neutral, PublicKeyToken=12345">
  <ns0:MyCustomActivity Prop1="Validation" Prop2="ValidateStep" 
	xmlns:p3="" />
Posted on Thursday, December 13, 2007 8:47 AM Windows Workflow Foundation (WF) , XAML (*.xoml) | Back to top

Comments on this post: Workflow defined as XAML-only + Custom Base Class

# re: Workflow defined as XAML-only + Custom Base Class
Requesting Gravatar...
Great post. That is just what I needed. If you are interested I've taken this and managed to get around the problem of it not rendering in the designer.
You need to switch the base namespace xmlns with ns0 and then prefix the standard wf activities with ns0 so that the root tag does not have the ns0 prefix.
It then displays ok

Left by Ian on Feb 21, 2008 11:10 PM

# re: Workflow defined as XAML-only + Custom Base Class
Requesting Gravatar...
What about custom properties in the code behind class? Can they be defined on XAML level?
Left by dnk.nitro on Mar 24, 2008 7:57 AM

# re: Workflow defined as XAML-only + Custom Base Class
Requesting Gravatar...
At SplendidCRM, it took us a little while to get XAML-only workflows work. But we took the base class issue one step further by registering our ASP.NET DLL with the workflow engine so that our workflows had full access to our the state of our ASP.NET application. In the end, we have a fully integrated data-driven workflow engine that allows administrators to define new workflows without any coding.
Left by SplendidCRM on Mar 31, 2009 4:30 PM

Your comment:
 (will show your gravatar)

Copyright © Jennifer Zouak | Powered by: