Search code examples
c#.netwpfworkflow-foundation

How to get the ActivityContext in order to get the value of an InArgument


I'm currently tinkering around with Workflow Foundation. I have an activity which contains the argument:

System.Activities.InArgument<double> Temperature

However, I want to get the value of this argument in my activity in order to do some validation with it (and also set properties in my activity based on this argument). I understand there is a Get method which takes an ActivityContext, so the actual value would be known at runtime. My question is, how can I get the ActivityContext, or is there a better way?

Note: I'm hosting the WorkflowDesigner in my app which I drop my activities on. So Activity1 contains a property "Temperature", and this is passed into Activity2 as an InArgument. I then validate Activity2, but so far can't get the ActivityContext. I don't need it at execution time, but at design time.

Thanks in advance.


Solution

  • Can you pass the ActivityContext to Activity2 as an argument?

    What about using Custom Activity Designers?