WorkflowView.RootDesigner 属性

定义

获取或设置 WorkflowView 的根设计器。

public:
 property System::Workflow::ComponentModel::Design::ActivityDesigner ^ RootDesigner { System::Workflow::ComponentModel::Design::ActivityDesigner ^ get(); void set(System::Workflow::ComponentModel::Design::ActivityDesigner ^ value); };
public System.Workflow.ComponentModel.Design.ActivityDesigner RootDesigner { get; set; }
member this.RootDesigner : System.Workflow.ComponentModel.Design.ActivityDesigner with get, set
Public Property RootDesigner As ActivityDesigner

属性值

ActivityDesigner 关联的 WorkflowView

示例

下面的示例演示如何检索 WorkflowView 对象的 RootDesigner。 workflowPanel 字段包含一个名为 GetWorkflowView 的方法,该方法返回活动的 WorkflowView 实例。 然后,在对 RootDesigner 进行任何操作前将其转换为 SequentialWorkflowRootDesigner。

此代码示例摘自 DesignerShell.cs 文件中的基本 DesignerHosting SDK 示例。 有关详细信息,请参阅 基本设计器托管示例

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");
    }
}
Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click
    Dim viewId As Integer
    Dim rootDesigner As SequentialWorkflowRootDesigner
    rootDesigner = Me.workflowPanel.GetWorkflowView().RootDesigner
    viewId = rootDesigner.ActiveView.ViewId
    If viewId = 1 Then
        Me.workflowPanel.OnCodeActivityAdded()
    Else
        Dim resultBox As DialogResult
        resultBox = MessageBox.Show("This sample supports adding a code activity only in workflow view")
    End If
End Sub

注解

工作流的根设计器是与工作流的设计图面关联的设计器。 它包含所有子设计器,以及随后工作流中所有的活动。

适用于