WorkflowView.RootDesigner Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the root designer for the WorkflowView.

Namespace:   System.Workflow.ComponentModel.Design
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

public ActivityDesigner RootDesigner { get; set; }

The root designer of the workflow is the designer associated with the design surface of the workflow. It contains all child designers, and subsequently all activities in the workflow.

The following example shows how to retrieve the RootDesigner of a WorkflowView object. The workflowPanel field contains a method named GetWorkflowView that returns the active WorkflowView instance. The RootDesigner is then cast to a SequentialWorkflowRootDesigner before any action is taken on it.

This code example is part of the Basic DesignerHosting SDK Sample from the DesignerShell.cs file. For more information, see Basic Designer Hosting Sample.

private void addButton_Click(object sender, EventArgs e)
{
    SequentialWorkflowRootDesigner rootDesigner = this.workflowPanel.GetWorkflowView().RootDesigner as SequentialWorkflowRootDesigner;
    int viewId = rootDesigner.ActiveView.ViewId;
    if (viewId == 1)
    {
        this.workflowPanel.OnCodeActivityAdded();
    }
    else
    {
        DialogResult resultBox = MessageBox.Show("This sample supports adding a code activity only in workflow view");
    }
}

.NET Framework
Available since 3.0
Return to top
Show: