Support of WF 4.5 Designer Improvements in Rehosted Scenarios

This sample illustrates how the following new WF 4.5 features could be enabled when rehosting the WF designer: outline view of workflow items, designer annotations, multi-select, auto-surround with sequence, pan mode, toolbox search

C# (223.0 KB)
5 Star
2,294 times
Add to favorites
E-mail Twitter Digg Facebook
//This C# project corresponds to the following Windows Workflow Foundation 4.5 Sample: 
//      "Support of WF 4.5 Designer Improvements in Rehosted Scenarios" 
//For a detailed explanation about this sample, please refer to Microsoft Word Document 
//that is included in the Solution folder of this sample. 

using System;
using System.Activities.Core.Presentation;
using System.Activities.Presentation;
using System.Activities.Statements;
using System.Windows;

namespace Annotations
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class RehostingWFDesigner_EnableAnnotations : Window
        public RehostingWFDesigner_EnableAnnotations()

        protected override void OnInitialized(EventArgs e)
            // register metadata
            (new DesignerMetadata()).Register();

            // create the workflow designer
            WorkflowDesigner wd = new WorkflowDesigner();
            // enable annotations
            wd.Context.Services.GetService<DesignerConfigurationService>().AnnotationEnabled = true;            
            // set the runtime Framework version to 4.5 as Annotation is a new feature in .NET 4.5 and did not exist in .NET 4
            wd.Context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 5));
            wd.Load(new Sequence());                        
            DesignerBorder.Child = wd.View;
            PropertyBorder.Child = wd.PropertyInspectorView;