Robert Wilczynski

I have implemented a custom activity that has a property of type:

19 [Browsable(true),

20 DesignerSerializer(typeof(DependencyObjectCodeDomSerializer), typeof(CodeDomSerializer)), DesignerSerializer(typeof(WorkflowMarkupSerializer), typeof(WorkflowMarkupSerializer)),

21 MergableProperty(false)]

22 public abstract class ActivityTimer : DependencyObject

23 {

27 protected ActivityTimer()

28 {

30 }

31 }



Property is declared as follows:



18 public static readonly DependencyProperty XTimerProperty = DependencyProperty.Register("XTimer", typeof(ActivityTimer), typeof(SubscribeToTimerEventActivity));

19

20 [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),

21 BrowsableAttribute(true),

22 RefreshProperties(RefreshProperties.Repaint),

23 DefaultValue((string)null),

24 Category("Timers"), TypeConverter(typeof(TimerTypeConverter))]

25 public ActivityTimer XTimer

26 {

27 get { return ((ActivityTimer)(base.GetValue(SubscribeToTimerEventActivity.XTimerProperty))); }

28 set { base.SetValue(SubscribeToTimerEventActivity.XTimerProperty, value); }

29 }


I also implemented a couple of types that derive from this abstract class, one of them being:

33 [DisplayName("Explicit Timer")]

34 public class ExplicitTimer : ActivityTimer

35 {

36 public static readonly DependencyProperty TimerProperty = DependencyProperty.Register("Timer", typeof(DateTime), typeof(ExplicitTimer));

37

38 [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

39 [BrowsableAttribute(true)]

40 public DateTime Timer

41 {

42 get { return ((DateTime)(base.GetValue(ExplicitTimer.TimerProperty))); }

43 set { base.SetValue(ExplicitTimer.TimerProperty, value); }

44 }

45

50 }


In my custom activity I want to allow a user to choose which of those types my property should be of, just like IfElseBranchActivity that allows the use to select the condition type. Everything works fine but after the user selects the appropriate subtype the properties like ExplicitTimer.Timer can not be bound. When I atttempt to bind it I get the following message:

---------------------------
Microsoft Workflow Designer
---------------------------
Can not bind selected property. Property binding is not supported for non Dependency Properties, selecting multiple activities for configuration and when viewing events in property browser.
---------------------------
OK
---------------------------

I will appreciate any help, even if it's simply a statement that binding dependency properties of complex dependency properties in a custom activity is not supported (if so is it only the designer limitation).

Best regards,
Robert Wilczynski.



Re: Windows Workflow Foundation Binding to dependency properties of a complex dependency property.

Robert Wilczynski

So the post is hanging here for more than 24 hours now without an answer. I was just wondering if my question is too confusing for someone to pick it up, or maybe someone from the WF team is already investigating this issue

In case my previous question was too confusing let me ask another question - maybe explaining my problem in terms of built-in activities will make things more obvious:

Let's say I'm developing an IfElseBranchActivity to use with an IfElseActivity. I have a list of condition types I can choose for property: IfElseBranchActivity.ActivityCondition. There are two types on that list:

RuleConditionReference
CodeCondition

Let's assume I want to bind a workflow property to RuleConditionReference.ConditionName. How should I implement RuleConditionReference to support this

Best regards,
Robert Wilczynski.






Re: Windows Workflow Foundation Binding to dependency properties of a complex dependency property.

Robert Wilczynski

I did some more research and it seems this is not a designer limitation. When I declared ActivityBind on ExplicitTimer.Timer property (in XAML bypassing the designer) the default value (DateTime.MinValue) was left unchanged at runtime so I assume this would be a limitation imposed by ActivityBind (a known limitation also enforced by the designer). So I assume my scenario is not supported in the current version of WWF (meaning I'm left with inheritance).

The question is - will it be supported with Orcas or a subsequent release

I guess this kind of feature would enable a nice alternative to inheritance when creating custom activities - call it a strategy pattern for activities. But to make it really usable binding is an absolute must.

Best regards,
Robert Wilczynski.





Re: Windows Workflow Foundation Binding to dependency properties of a complex dependency property.

Qiang Lin - MSFT

Are you trying to bind a property of an activity to a property of a property of another activity using the ActivityBind For all your explainations, I cannot still follow them clearly. I doubt I have time to try your examples.

"The question is - will it be supported with Orcas or a subsequent release "

To answer the question, it is necessary to make sure what we are talking about.