Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ms.assetid: 98135077-0f5d-4d16-9337-01094e843537
---
# Customizing the Workflow Design Experience

The scenarios for designing custom activities and for rehosting the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] have been greatly simplified in .NET Framework 4. Development and deployment are now both easier and more flexible. The key infrastructural change is that the new activity designer programming model is built upon Windows Presentation Foundation (WPF). This gives you the ability to define activity designers declaratively and to rehost the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)] in other applications with comparative easy. When rehosting, a custom expression editor can be developed to support IntelliSense or a simplified expression domain. The integration with Windows Communication Foundation (WCF) has become more seamless with use of workflow services. Custom activity designers and the Model Item Tree can be used to enhance design time experiences in rehosted workflow designers.
The scenarios for designing custom activities and for rehosting the Windows Workflow Designer have been greatly simplified in .NET Framework 4. Development and deployment are now both easier and more flexible. The key infrastructural change is that the new activity designer programming model is built upon Windows Presentation Foundation (WPF). This gives you the ability to define activity designers declaratively and to rehost the Workflow Designer in other applications with comparative easy. When rehosting, a custom expression editor can be developed to support IntelliSense or a simplified expression domain. The integration with Windows Communication Foundation (WCF) has become more seamless with use of workflow services. Custom activity designers and the Model Item Tree can be used to enhance design time experiences in rehosted workflow designers.

## In This Section

Expand All @@ -17,7 +17,7 @@ The scenarios for designing custom activities and for rehosting the [!INCLUDE[wf

[Rehosting the Workflow Designer](rehosting-the-workflow-designer.md)

Describes how to re-host the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] outside of Visual Studio and how to display validation errors.
Describes how to re-host the Windows Workflow Designer outside of Visual Studio and how to display validation errors.

[Using a Custom Expression Editor](using-a-custom-expression-editor.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/windows-workflow-foundation/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following section describes how to extend Windows Workflow Foundation (WF) w

## In This Section
[Customizing the Workflow Design Experience](customizing-the-workflow-design-experience.md)
Indicates how the scenarios for designing custom activities and for rehosting the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] have been greatly simplified in .NET Framework 4. Development and deployment are now both easier and more flexible because the new activity designer programming model is built upon Windows Presentation Foundation (WPF).
Indicates how the scenarios for designing custom activities and for rehosting the Windows Workflow Designer have been greatly simplified in .NET Framework 4. Development and deployment are now both easier and more flexible because the new activity designer programming model is built upon Windows Presentation Foundation (WPF).

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ms.assetid: 6760a5cc-6eb8-465f-b4fa-f89b39539429
---
# How to: Create a Custom Activity Template

Custom activity templates are used to customize the configuration of activities, including custom composite activities, so that users do not have to create each activity individually and configure their properties and other settings manually. These custom templates can be made available in the **Toolbox** on the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] or from a rehosted designer, from which users can drag them onto the preconfigured design surface. [!INCLUDE[wfd2](../../../includes/wfd2-md.md)] ships with good examples of such templates: the [SendAndReceiveReply Template Designer](/visualstudio/workflow-designer/sendandreceivereply-template-designer) and the [ReceiveAndSendReply Template Designer](/visualstudio/workflow-designer/receiveandsendreply-template-designer) in the [Messaging Activity Designers](/visualstudio/workflow-designer/messaging-activity-designers) category.
Custom activity templates are used to customize the configuration of activities, including custom composite activities, so that users do not have to create each activity individually and configure their properties and other settings manually. These custom templates can be made available in the **Toolbox** on the Windows Workflow Designer or from a rehosted designer, from which users can drag them onto the preconfigured design surface. Workflow Designer ships with good examples of such templates: the [SendAndReceiveReply Template Designer](/visualstudio/workflow-designer/sendandreceivereply-template-designer) and the [ReceiveAndSendReply Template Designer](/visualstudio/workflow-designer/receiveandsendreply-template-designer) in the [Messaging Activity Designers](/visualstudio/workflow-designer/messaging-activity-designers) category.

The first procedure in this topic describes how to create a custom activity template for a **Delay** activity and the second procedure describes briefly how to make it available in a [!INCLUDE[wfd2](../../../includes/wfd2-md.md)] to verify that the custom template works.
The first procedure in this topic describes how to create a custom activity template for a **Delay** activity and the second procedure describes briefly how to make it available in a Workflow Designer to verify that the custom template works.

Custom activity templates must implement the <xref:System.Activities.Presentation.IActivityTemplateFactory>. The interface has a single <xref:System.Activities.Presentation.IActivityTemplateFactory.Create%2A> method with which you can create and configure the activity instances used in the template.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ms.date: "03/30/2017"
ms.assetid: 5aa8fb53-8f75-433b-bc06-7c7d33583d5d
---
# How to: Display Validation Errors in a Rehosted Designer
This topic describes how to retrieve and publish validation errors in a rehosted [!INCLUDE[wfd1](../../../includes/wfd1-md.md)]. This provides us with a procedure to confirm that a workflow in a rehosted designer is valid.
This topic describes how to retrieve and publish validation errors in a rehosted Windows Workflow Designer. This provides us with a procedure to confirm that a workflow in a rehosted designer is valid.

This task has two parts. The first is to provide an implementation <xref:System.Activities.Presentation.Validation.IValidationErrorService>. There is one critical method to implement on this interface, <xref:System.Activities.Presentation.Validation.IValidationErrorService.ShowValidationErrors%2A> which will pass you a list of <xref:System.Activities.Presentation.Validation.ValidationErrorInfo> objects containing information about the errors to the debug log. After implementing the interface, you retrieve the error information by publishing an instance of that implementation to the editing context.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ ms.date: "03/30/2017"
ms.assetid: bec1fc28-f902-4edb-86c5-436cec802c2b
---
# Rehosting the Workflow Designer
The [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] can be rehosted in environments outside of Visual Studio 2012 for the purposes of creating, modifying, and monitoring workflows.
The Windows Workflow Designer can be rehosted in environments outside of Visual Studio 2012 for the purposes of creating, modifying, and monitoring workflows.

The <xref:System.Activities.Presentation.WorkflowDesigner> type is a wrapper of the canvas, property grid, and other elements, and exposes a basic programming model to handle the majority of designer rehosting scenarios. Hosting the <xref:System.Activities.Presentation.WorkflowDesigner> inside a Windows Presentation Foundation (WPF) application is a common rehosting scenario for [!INCLUDE[wfd2](../../../includes/wfd2-md.md)].
The <xref:System.Activities.Presentation.WorkflowDesigner> type is a wrapper of the canvas, property grid, and other elements, and exposes a basic programming model to handle the majority of designer rehosting scenarios. Hosting the <xref:System.Activities.Presentation.WorkflowDesigner> inside a Windows Presentation Foundation (WPF) application is a common rehosting scenario for Workflow Designer.

## In This Section
[Task 1: Create a New Windows Presentation Foundation Application](task-1-create-a-new-wpf-app.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This section provides samples that demonstrate basic Windows Workflow Foundation
Contains samples that demonstrate creating custom activities.

[Designer](designer.md)
Contains samples that demonstrate how to use [!INCLUDE[wfd1](../../../../includes/wfd1-md.md)].
Contains samples that demonstrate how to use Windows Workflow Designer.

[Designer ReHosting](designer-rehosting.md)
Contains samples that demonstrate re-hosting the activity designer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ms.date: "03/30/2017"
ms.assetid: bf28aae3-ddfb-4a86-b55d-1957f08c4e10
---
# Designer
This section contains samples that demonstrate how to use [!INCLUDE[wfd1](../../../../includes/wfd1-md.md)].
This section contains samples that demonstrate how to use Windows Workflow Designer.

## In This Section
[Removing the View State the Designer Adds to an XAML File](removing-the-view-state-the-designer-adds-to-an-xaml-file.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ms.assetid: 0229efde-19ac-4bdc-a187-c6227a7bd1a5
This sample demonstrates how to navigate the <xref:System.Activities.Presentation.Model.ModelItem> tree using declarative data binding from the Windows Presentation Foundation (WPF) Tree View.

## Sample Details
The <xref:System.Activities.Presentation.Model.ModelItem> tree is the abstraction that is used by the [!INCLUDE[wfd1](../../../../includes/wfd1-md.md)] infrastructure to expose the data about the underlying instance being edited. The following illustration is a depiction of the various layers of infrastructure within the [!INCLUDE[wfd2](../../../../includes/wfd2-md.md)].
The <xref:System.Activities.Presentation.Model.ModelItem> tree is the abstraction that is used by the Windows Workflow Designer infrastructure to expose the data about the underlying instance being edited. The following illustration is a depiction of the various layers of infrastructure within the Workflow Designer.

![Diagram that shows the Workflow Designer architecture.](./media/programming-model-item-tree/workflow-designer-architecture.jpg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ms.assetid: a801ce22-8699-483c-a392-7bb3834aae4f
---
# Removing the view state the designer adds to an XAML file

This sample demonstrates how to create a class that derives from <xref:System.Xaml.XamlWriter> and removes view state from a XAML file. [!INCLUDE[wfd1](../../../../includes/wfd1-md.md)] writes information into the XAML document, which is known as view state. View state refers to the information that is required at design time, such as layout positioning, that is not required at runtime. [!INCLUDE[wfd2](../../../../includes/wfd2-md.md)] inserts this information into the XAML document as it is edited. [!INCLUDE[wfd2](../../../../includes/wfd2-md.md)] writes the view state into the XAML file with the `mc:Ignorable` attribute, so this information is not loaded when the runtime loads the XAML file. This sample demonstrates how to create a class that removes that view state information while processing XAML nodes.
This sample demonstrates how to create a class that derives from <xref:System.Xaml.XamlWriter> and removes view state from a XAML file. Windows Workflow Designer writes information into the XAML document, which is known as view state. View state refers to the information that is required at design time, such as layout positioning, that is not required at runtime. Workflow Designer inserts this information into the XAML document as it is edited. Workflow Designer writes the view state into the XAML file with the `mc:Ignorable` attribute, so this information is not loaded when the runtime loads the XAML file. This sample demonstrates how to create a class that removes that view state information while processing XAML nodes.

## Discussion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ A state machine is a well-known paradigm for developing programs. The <xref:Syst
A state machine workflow must have one and only one initial state, and at least one final state. Each state that is not a final state must have at least one transition. The following sections cover creating and configuring states and transitions.

## Creating and Configuring States
A <xref:System.Activities.Statements.State> represents a state in which a state machine can be in. To add a <xref:System.Activities.Statements.State> to a workflow, drag the **State** activity designer from the **State Machine** section of the **Toolbox** and drop it onto a <xref:System.Activities.Statements.StateMachine> activity on the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] surface.
A <xref:System.Activities.Statements.State> represents a state in which a state machine can be in. To add a <xref:System.Activities.Statements.State> to a workflow, drag the **State** activity designer from the **State Machine** section of the **Toolbox** and drop it onto a <xref:System.Activities.Statements.StateMachine> activity on the Windows Workflow Designer surface.

![Screenshot of the State Machine section of the Toolbox.](./media/state-machine-workflows/state-machine-section-toolbox.jpg)

To configure a state as the **Initial State**, right-click the state and select **Set as Initial State**. Additionally, if there is no current initial state, the initial state can be designated by dragging a line from the **Start** node at the top of the workflow to the desired state. When a <xref:System.Activities.Statements.StateMachine> activity is dropped onto the workflow designer, it is pre-configured with an initial state named **State1**. A state machine workflow must have one and only one initial state.

A state that represents a terminating state in a state machine is called a final state. A final state is a state that has its <xref:System.Activities.Statements.State.IsFinal%2A> property set to `true`, has no <xref:System.Activities.Statements.State.Exit%2A> activity, and no transitions originating from it. To add a final state to a workflow, drag a **FinalState** activity designer from the **State Machine** section of the **Toolbox** and drop it onto a <xref:System.Activities.Statements.StateMachine> activity on the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] surface. A state machine workflow must have at least one final state.
A state that represents a terminating state in a state machine is called a final state. A final state is a state that has its <xref:System.Activities.Statements.State.IsFinal%2A> property set to `true`, has no <xref:System.Activities.Statements.State.Exit%2A> activity, and no transitions originating from it. To add a final state to a workflow, drag a **FinalState** activity designer from the **State Machine** section of the **Toolbox** and drop it onto a <xref:System.Activities.Statements.StateMachine> activity on the Windows Workflow Designer surface. A state machine workflow must have at least one final state.

### Configuring Entry and Exit Actions
A state can have an <xref:System.Activities.Statements.State.Entry%2A> and an <xref:System.Activities.Statements.State.Exit%2A> action. (A state configured as a final state may have only an entry action). When a workflow instance enters a state, any activities in the entry action execute. When the entry action is complete, the triggers for the state’s transitions are scheduled. When a transition to another state is confirmed, the activities in the exit action are executed, even if the state transitions back to the same state. After the exit action completes, the activities in the transition’s action execute, and then the new state is transitioned to, and its entry actions are scheduled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ ms.assetid: 0a29b138-270d-4846-b78e-2b875e34e501
---
# Task 2: Host the Workflow Designer

This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1](../../../includes/wfd1-md.md)] in a Windows Presentation Foundation (WPF) application.
This topic describes the procedure for hosting an instance of the Windows Workflow Designer in a Windows Presentation Foundation (WPF) application.

The procedure configures the **Grid** control that contains the designer, programmatically creates an instance of the <xref:System.Activities.Presentation.WorkflowDesigner> that contains a default <xref:System.Activities.Statements.Sequence> activity, registers the designer metadata to provide designer support for all built-in activities, and hosts the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)] in the WPF application.
The procedure configures the **Grid** control that contains the designer, programmatically creates an instance of the <xref:System.Activities.Presentation.WorkflowDesigner> that contains a default <xref:System.Activities.Statements.Sequence> activity, registers the designer metadata to provide designer support for all built-in activities, and hosts the Workflow Designer in the WPF application.

## To host the workflow designer

1. Open the HostingApplication project you created in [Task 1: Create a New Windows Presentation Foundation Application](task-1-create-a-new-wpf-app.md).

2. Adjust the size of the window to make it easier to use the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)]. To do this, select **MainWindow** in the designer, press F4 to display the **Properties** window, and, in the **Layout** section there, set the **Width** to a value of 600 and the **Height** to a value of 350.
2. Adjust the size of the window to make it easier to use the Workflow Designer. To do this, select **MainWindow** in the designer, press F4 to display the **Properties** window, and, in the **Layout** section there, set the **Width** to a value of 600 and the **Height** to a value of 350.

3. Set the grid name by selecting the **Grid** panel in the designer (click the box inside the **MainWindow**) and setting the **Name** property at the top of the **Properties** window to "grid1".

4. In the **Properties** window, click the ellipsis (**…**) next to the `ColumnDefinitions` property to open the **Collection Editor** dialog box.

5. In the **Collection Editor** dialog box, click the **Add** button three times to insert three columns into the layout. The first column will contain the **Toolbox**, the second column will host the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)], and the third column will be used for the property inspector.
5. In the **Collection Editor** dialog box, click the **Add** button three times to insert three columns into the layout. The first column will contain the **Toolbox**, the second column will host the Workflow Designer, and the third column will be used for the property inspector.

6. Set the `Width` property of the middle column to the value "4*".

Expand Down Expand Up @@ -82,7 +82,7 @@ The procedure configures the **Grid** control that contains the designer, progra
}
```

4. Register the designer metadata to add designer support for all the built-in activities. This enables you to drop activities from the toolbox onto the original <xref:System.Activities.Statements.Sequence> activity in the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)]. To do this, add the `RegisterMetadata` method to the `MainWindow` class:
4. Register the designer metadata to add designer support for all the built-in activities. This enables you to drop activities from the toolbox onto the original <xref:System.Activities.Statements.Sequence> activity in the Workflow Designer. To do this, add the `RegisterMetadata` method to the `MainWindow` class:

```csharp
private void RegisterMetadata()
Expand Down
Loading