Bind parameters to dependant properties?
Jared
Jared
Hi Jared,
There is an known bug in Beta1 where the workflow parameters do not show up in the Activity Reference dialog to bind. This is fixed now and should be available in Beta2
Thanks,
Vihang
To answer your first question, you can bind an activity property to workflow parameter using the following code
<?
Mapping XmlNamespace="System" ClrNamespace="System" Assembly="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" ?><?
Mapping XmlNamespace="CustomActivities" ClrNamespace="CustomActivities" Assembly="CustomActivities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=71530258abd56239" ?><
SequentialWorkflow x:Class="WorkflowLibrary1.Workflow1" x:CompileWith="Workflow1.xoml.cs" ID="Workflow1" xmlns:x="Definition" xmlns="Activities"><SequentialWorkflow.Parameters>
<wcm:ParameterDeclaration Name="w" Type="{x:Type System.String}" Direction="In" xmlns:wcm="ComponentModel" />
</SequentialWorkflow.Parameters>
<ns1:
MyActivity ID="myActivity" xmlns:ns1="CustomActivities"></
SequentialWorkflow>Hope this Helps.
Thanks.
someActivity.SetBinding(SomeDependencyProperty, bind1);
I'm having issues getting this to work...
e.g.
This works
private void EMailWorkflow_Initialized(object sender, EventArgs e) This gives a build error public Error:
{
this.applicantAccount = (string)this.Parameters["ApplicantAccount"].Value;
}
{
InitializeComponent();
ActivityBind bind;
bind = new ActivityBind("EMailWorkflow", "Parameters[\"ApplicantAccount\"].Value");
this.LookupManager.SetBinding(DirectoryLookupActivity.QueryProperty, bind);
}
Error 1 Activity 'LookupManager' validation failed: Property 'Parameters["ApplicantAccount"].Value' is not set for the referenced activity 'EMailWorkflow'. d:\Projects\Microsoft\WWF\WWF EMail Sample\Project\LeaveWorkflows\EMailWorkflow.cs 1 1
To work around thid, you can put the attribute: [ on the QueryProperty to disable validations for it. At runtime we will try to do the typecast and throw an exception if it fails.