Is there support for attached properties in Windows Workflow Foundation 4?
If not, how are scenarios common to attached properties (“arbitrary property of parent associated with children”) supported in Windows Workflow Foundation 4?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, and also yes. Compared to WF 3.* it is quite different.
Attached properties are not available by default on any of the Activity classes in System.Activities. System.Activity and itse subclasses do not implement DependencyObject, and do not allow WPF attached properties to be set on them in the way 3.* workflow classes did.
However, attached properties are supported at design time within the Workflow Designer (rehosted or in Visual Studio). When you load an activity XAML file, the Activites in the XAML file are loaded wrapped in ModelItems. ModelItem does not implement DependencyObject either, however, there is a design time service which allows you to add AttachedProperties to model items based on the class of the underlyinng object: this is the AttachedPropertiesService (reached from EditingContext.Services). [I can’t remember whether these attached properties are serialized to XAML automatically.]
Along with AttachedPropertiesService, ViewStateService is also used for scenarios where design-time data is to be attached to an object, and serialized in XAML, such as specifying flowchart node placement.
(P.S. Other posters are also right that Variables and Arguments are used for passing data to/from activities, but I’m not sure how that addresses the attaching arbitrary values issue.)