Windows Workflow Foundation 3

Problems with Xaml Activation and ActivityBinding to custom activity

I have a xoml-only workflow that I'm running via xaml activation.  It inherits from a base workflow in another project which conatins a public string property called MyWorkflowProperty.  All I want to do, is define my workflow in xoml and put an ActivityBind on the MyStringProperty of my CustomActivity, and bind that to MyWorkflowProperty.
In the same workflow, I'm able to successfully bind the ExecuteCode property of a code activity to a method defined on my BaseWorkflow, and yet everytime I get to the part where I try to bind the CustomActivity property to the Workflow property I get this error: "error 347: Could not deserialize member 'MyStringProperty'.  Could not set value '{ActivityBind Name=TestWorkflow1,Path=MyWorkflowProperty}' on member 'MyStringProperty' of type ActivityLibrary.CustomActivity'.  Object of type 'System.Workflow.ComponentModel.ActivityBind' cannot be converted to type 'System.String'."
I know CustomActivity works, because if I remove the {ActivityBind..} xaml and replace it with any normal string, everything works just fine.  Please help!!!!
So I have a project called ActivityLibrary that contains an activity called CustomActivity which  contains a public string property called MyStringProperty.  In this same project I have a workflow called BaseWorkflow which looks like this:
public sealed partial class BaseWorkflow: SequentialWorkflowActivity
private string _workflowPropertyString = string.Empty;
public string MyWorkflowProperty
get { return _workflowPropertyString; }
set { _workflowPropertyString = value; }
public void Test(object sender, EventArgs e)
Console.WriteLine("ActivityBind Testmethod call successful");
public BaseWorkflow()
In another project called XamlActivationTest I have Program.cs which contains this:
class Program
static void Main(string[] args)
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) {waitHandle.Set();};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
TypeProvider typeProvider = new TypeProvider(workflowRuntime);
XmlReader reader = XmlReader.Create(#"..\..\TestWorkflow.xoml");
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("MyWorkflowProperty", "Passed in string");
WorkflowInstance instance = null;
instance = workflowRuntime.CreateWorkflow(reader, null, parameters);
catch (WorkflowValidationFailedException exp)
StringBuilder errors = new StringBuilder();
foreach (ValidationError error in exp.Errors)
MessageBox.Show(errors.ToString(), "Validation errors");
The actual file TestWorkflow.xoml which it is using xaml activation to execute isn't a part of any project, but it does live on the file system in the specified location.  Here is the xoml file:
<ns0:BaseWorkflow x:Name="TestWorkflow1" MyWorkflowProperty="{x:Null}" xmlns:ns0="clr-namespace:RealActivityLibrary;Assembly=ActivityLibrary, Version=, Culture=neutral, PublicKeyToken=null" xmlns:x="" xmlns="">
    <DelayActivity x:Name="delayActivity1" TimeoutDuration="00:00:01"></DelayActivity>    <CodeActivity x:Name="codeActivity1" ExecuteCode="{ActivityBind Name=TestWorkflow1,Path=Test}"></CodeActivity>    <ns0:CustomActivity x:Name="CustomActivity1" MyStringProperty="{ActivityBind Name=TestWorkflow1,Path=MyWorkflowProperty}"></ns0:CustomActivity>
Ok, I got this to work by creating a dependency property on my custom activity that correlates with the normal .NET property.  After that it worked like a charm.  Apparently normal .NET properties on activities don't work with ActivityBind.  Live and learn.
Oh yeah, here's my CustomActivity code-beside:
namespace ActivityLibrary
public partial class CustomActivity : SequenceActivity, IActivity
private string _myStringProperty = string.Empty;
public string MyStringProperty
get { return _myStringProperty; }
set { _myStringProperty = value; }
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
Console.WriteLine("MyStringProperty = " + this.MyStringProperty);
Console.WriteLine("Inside Custom Activity--press enter to continue");
and here's the Interface that it implements:
public interface IActivity
string MyStringProperty { get; set;}
Ok, I got this to work by creating a dependency property on my custom activity that correlates with the normal .NET property.  After that it worked like a charm.  Apparently normal .NET properties on activities don't work with ActivityBind.  Live and learn.
Can you post a snippet of your solution? An example of the dependency property on your custom activity that correlates with the normal .net property.

Related Links

Tracking by objects
Sample unit testing project for a code activity
How to display the provider type summary in RuleSetDialog
Windows WF3.0 - get activity information from TrackingRecord object
Workflow Rules - Chaining for Indexers
WCSF PageFlow
front end
Dynamic Workflow Creation
ApplyworkflowChanges takes long time and some time crashes the application.
CLR20r3 Error when i run exe file (C#)
Process is terminated due to StackOverflowException
HandleExternalEvent: event filter / correlation
SqlTrackingService & User Events
How to change the sendemail activity property at run time?
Question on Queue Management
Load rules in the Designer Rehosting demo


Visual Studio Design a...
Windows Embedded Compact
Microsoft Research
Windows Hardware Devel...
Unified Communications
Archived Forums A-B
In-App Advertising (Ad...
Suggestions and Feedba...
MSDN and TechNet Profi...
Visual Studio Editor
Visual Studio Graphics...
Developing Universal W...
User Interface develop...
SharePoint 2013 - Search
Cloud Services (Web an...
Azure Management Portal
Azure BizTalk Services
Azure Pack
Language Understanding...
Azure DevTest Labs
Azure Functions
Software Modeling Tools
The Architect Role
BizTalk ESB Toolkit
WCF Data Services
The Forum of Sho
Internet Explorer Exte...
Microsoft Robotics - C...
Microsoft Robotics - D...
SQL Server Tools
SQL Server Security
SQL Server Documentation
SQL Server Express
SQL Server Migration
Power Pivot
SQL Server Distributed...
SQL Server In-Memory T...
Windows Embedded 8 Sta...
Standard 2009: Tools
Standard 7: Tools
Standard 7: Misc
SQL Server 2012 Master...
Windows Forms Designer
Windows Forms Sample A...
Server Virtualization
Windows Live ID: Devel...
MSDN Subscriptions Fee...
WebsitePanel - Discuss...
WebsitePanel - Enterpr...
WebsitePanel - Develop...
Exchange Server Protocols
Project Customization ...
Bing Ads API: Development
Hosting and Streaming ...
Search Server: Install...
Retired InfoPath Forms...
Retired SharePoint Ent...
Project Standard and P...
.NET Framework 4 Relea...
AppFabric Service and ...
Architecture, Tools, a...
Axum Incubation Project
Building Development a...
Building Windows Store...
Game Technologies: Dir...
(Retired) Exchange Pre...
Face Tracking – Kinect...
Git, Mercurial and Dro...
Installing and Registe...
LINQ Project General
Managed Extensibility ...
Model-Based Testing wi...
Moderator Posting Only...
Office Live Small Busi...
Office Live Small Busi...
Popfly General Discussion
NUI API and Programmin...
Search Server: Develop...
Silverlight (formerly ...
SQL Server Modeling
SQL Server 2014 Databa...
Team Foundation Server...
Using Visual Round Tri...
TFS Deployment to Azure
UI Design for Windows ...
Visual Basic Express 2...
Visual Basic Express E...
Visual Basic Interop a...
Visual C# Express Edition
Visual C# Language
Visual Studio LightSwi...
Visual Studio Source C...
Windows Events
Windows XP Wireless SDK
Building Windows Store...
Expression Blend for W...
Windows Containers
Open source Developmen...


Encrypt Message