ActivityDesigner.Verbs 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取与设计器关联的谓词的集合。
protected:
virtual property System::Workflow::ComponentModel::Design::ActivityDesignerVerbCollection ^ Verbs { System::Workflow::ComponentModel::Design::ActivityDesignerVerbCollection ^ get(); };
protected virtual System.Workflow.ComponentModel.Design.ActivityDesignerVerbCollection Verbs { get; }
member this.Verbs : System.Workflow.ComponentModel.Design.ActivityDesignerVerbCollection
Protected Overridable ReadOnly Property Verbs As ActivityDesignerVerbCollection
属性值
与设计器关联的谓词的集合。
示例
下面的示例演示如何重写 Verbs 属性以插入 ActivityPreviewDesigner 的自定义谓词操作。 CreateActivityVerbs
创建一个名为 ActivityDesignerVerb 的新 "Add New Parallel Branch"
,并将它与名为 OnAddParallelBranch
的事件处理程序关联。 在工作流设计器中单击该谓词时,即会调用该事件处理程序。
private ActivityDesignerVerbCollection verbs = null;
protected override ActivityDesignerVerbCollection Verbs
{
get
{
if (this.verbs == null)
CreateActivityVerbs();
return this.verbs;
}
}
private void CreateActivityVerbs()
{
this.verbs = new ActivityDesignerVerbCollection();
ActivityDesignerVerb addBranchVerb = new ActivityDesignerVerb(this,
DesignerVerbGroup.View, "Add New Parallel Branch", new EventHandler(OnAddParallelBranch));
this.verbs.Clear();
this.verbs.Add(addBranchVerb);
}
protected void OnAddParallelBranch(object sender, EventArgs e)
{
// Code for adding a new branch to the parallel activity goes here
}
Private verbsValue As ActivityDesignerVerbCollection = Nothing
Protected Overrides ReadOnly Property Verbs() As ActivityDesignerVerbCollection
Get
If verbsValue Is Nothing Then
CreateActivityVerbs()
End If
Return Me.verbsValue
End Get
End Property
Private Sub CreateActivityVerbs()
Me.verbsValue = New ActivityDesignerVerbCollection()
Dim addBranchVerb As New ActivityDesignerVerb(Me, DesignerVerbGroup.View, "Add New Parallel Branch", AddressOf OnAddParallelBranch)
Me.verbsValue.Clear()
Me.verbsValue.Add(addBranchVerb)
End Sub
Protected Sub OnAddParallelBranch(ByVal sender As Object, ByVal e As EventArgs)
' Code for adding a new branch to the parallel activity goes here
End Sub
注解
使用 Verbs 方法可确定要显示在上下文菜单中的谓词。