Matt VanBergen

Hello,

I have an issue when trying to bind a dependancy property of a custom activity. When I open the Activity Bind dialog box I try to bind the dependancy property to a property on my workflow. The problem is that this property is not available in the Activity Bind dialog. It is the same type and I have tried making it a normal property and a dependancy property. Other properties that are on my workflow are available in the dialog box, but not this Request property. Do i have a setting wrong I have pasted the relevant code below. Can someone see why this is happening

Thanks!

Custom Activity Snippet:

public partial class CreateRequest : Activity
{
public static DependencyProperty RequestProperty = DependencyProperty.Register("Request", typeof(ReqRequestEntity), typeof(CreateRequest));

private static readonly ILog log = LogManager.GetLogger(typeof(CreateRequest));

public CreateRequest()
{
InitializeComponent();
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
[Category("Request")]
[Description("The Request property is used to specify the Request to be inserted.")]
public ReqRequestEntity Request
{
get
{
return ((ReqRequestEntity)(base.GetValue(CreateRequest.RequestProperty)));
}
set
{
base.SetValue(CreateRequest.RequestProperty, value);
}
}

Workflow Snippet:

public sealed partial class RequestWorkflow : StateMachineWorkflowActivity
{
private object requestSenderValue = new Object();
private static readonly ILog log = LogManager.GetLogger(typeof(RequestWorkflow));
private Exception _thrownException;
public RequestWorkflowArgs requestEventArgs = default(RequestWorkflowArgs);


public static DependencyProperty RequestProperty = DependencyProperty.Register("Request", typeof(ReqRequestEntity), typeof(RequestWorkflow));

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Browsable(true)]
[Category("Request")]
[Description("The Request property is used to specify the Request to be inserted.")]
public ReqRequestEntity Request
{
get
{
return ((ReqRequestEntity)(base.GetValue(RequestWorkflow.RequestProperty)));
}
set
{
base.SetValue(RequestWorkflow.RequestProperty, value);
}
}


Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Nigel_A

Hi Matt

I've had this behavior when the type that you are trying to bind, the custom activity, and the workflow are in separate class libraries. The fix for me was to rebuild the solution.

Nigel





Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Anderson Imes

I have this same problem and it seems like your description is correct. As long as the Activity and the Workflow are in the same assembly, I can bind from properties in the workflow to properties in the activity. If I move the activity out of the library (into, I dunno.. a library full of awesome activities... just like you'd want to use it) it can't figure out how to pair up your custom types.

A rebuild of the solution does *not* fix this issue for me.





Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Anderson Imes

If I can't find any clues in the next couple of hours, I will open a MS Support ticket about this and let you guys know if Microsoft Support can help me.





Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Nigel_A

Hi Anderson

I wasn't very clear in my description of my fix! (In fact I was actually incorrect). Like you, I've found that if you rebuild the complete solution, then this sometimes does not work. However, what did work for me reliably was to rebuild just the activity library.

Regards

Nigel





Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Anderson Imes

Thanks Nigel, but that doesn't seem to work for my either. I've tried builds and rebuilds 40 ways from Sunday and I still can't seem to get this thing to let me bind two properties of the same type - it just doesn't give me the option.

I might be forced to switch to a XOML workflow where at least I can add it manually via XML. I really hate this option, however.





Re: Windows Workflow Foundation Activity binding to a workflow parameter.

Tom Lake - MSFT

The problem is that VS caches the compiled assembly every time you build and it gets confused some times as to which version it is using. Try doing Build Clean, close and re-open VS and then build. I would also suggest that you configure your solution so that the activities / types projects are not compiled except when you make changes. This should reduce the number of times you have to close / reopen VS. It is only a problem while designing, once you are using an assembly reference, like your user, you will not see the problem since the compiled assembly is not changing.