Bind parameters to dependant properties?

Curently you can bind dependant properties of one activity to a property of another. But I don't see a way to bind a dependant property to a parameter passed into the workflow. Is there a way to do this? Could it be added?

Jared

[232 byte] By [JaredBienz] at [2008-2-15]
# 1

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

vihang at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

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">
<ns1:MyActivity .MyProperty>
<
wcm:ActivityBind Path="Parameters[&quot;w&quot;].Value" ID="/Parent" xmlns:wcm="ComponentModel" />
<ns1:MyActivity .MyProperty>
</ns1:MyActivity>

</SequentialWorkflow>

Hope this Helps.

Thanks.

vihang at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
Those are the answers I needed. Thanks guys.
JaredBienz at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Hi
Can you show this same thing in C# or VB.NET
THERAZI at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
ActivityBind bind1 = new ActivityBind();
bind1.ID = "/Workflow";
bind1.Path = "Parameters[\"ParameterName\"].Value";

someActivity.SetBinding(SomeDependencyProperty, bind1);

AkashSagar at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6

I'm having issues getting this to work...

e.g.
This works

private void EMailWorkflow_Initialized(object sender, EventArgs e)
{
this.applicantAccount = (string)this.Parameters["ApplicantAccount"].Value;
}

This gives a build error

public EMailWorkflow()
{
InitializeComponent();
ActivityBind bind;
bind = new ActivityBind("EMailWorkflow", "Parameters[\"ApplicantAccount\"].Value");
this.LookupManager.SetBinding(DirectoryLookupActivity.QueryProperty, bind);
}

Error:
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

ChrisAuld at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 7
One reason could be that the QueryProperty is not of type object. Parameters["ApplicationAccount"].Value is of type object and type conversions are not supported.

To work around thid, you can put the attribute:

[ValidationVisibilityAttribute(ValidationVisibility.Hidden)]

on the QueryProperty to disable validations for it. At runtime we will try to do the typecast and throw an exception if it fails.

AkashSagar at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified