Monday, 18 June 2007

Windows Workflow Foundation Activity Dependency Properties

I had been implementing a custom activity in WWF and added some dependecy properties to the actvity to allow binding. I tried and tried but for some reason i could not get the little blue i at the side of my properties to show it was bindable.

Here is what i had put in my activity:

Public Shared ToProperty As DependencyProperty = DependencyProperty.Register("To", GetType(String), GetType(SendEmailActivity), New PropertyMetadata(

Public Property EmailTo() As String
Return CType(MyBase.GetValue(SendEmailActivity.ToProperty), String)
End Get

Set(ByVal value As String)
MyBase.SetValue(SendEmailActivity.ToProperty, value)
End Set

End Property

As you can see i had ToProperty and EmailTo as the names. Even though they were pointing to each other the dependency property and the .NET accessor property need to be identical. They are even case sensitive!!

One to watch out for if you are doing any WWF and custom activities.

No comments: