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)
2,294 times
Add to favorites
7/7/2012
E-mail Twitter del.icio.us 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;
using System.Activities.Core.Presentation;
using System.Activities.Presentation;
using System.Windows;

namespace AutoSurroundWithSequence
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class RehostingWFDesigner_EnableAutoSurround : Window
    {
        public RehostingWFDesigner_EnableAutoSurround()
        {
            InitializeComponent();
        }

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

            // create the workflow designer
            WorkflowDesigner wd = new WorkflowDesigner();
            
            // 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));

            // enable AutoSurroundWithSequence
            wd.Context.Services.GetService<DesignerConfigurationService>().AutoSurroundWithSequenceEnabled = true;
            
            wd.Load(new ActivityBuilder());
            DesignerBorder.Child = wd.View;
            PropertyBorder.Child = wd.PropertyInspectorView;

        }
    }
}