IWebActionable.Verbs 属性

定义

获取对自定义 WebPartVerb 对象的集合的引用。

public:
 property System::Web::UI::WebControls::WebParts::WebPartVerbCollection ^ Verbs { System::Web::UI::WebControls::WebParts::WebPartVerbCollection ^ get(); };
public System.Web.UI.WebControls.WebParts.WebPartVerbCollection Verbs { get; }
member this.Verbs : System.Web.UI.WebControls.WebParts.WebPartVerbCollection
Public ReadOnly Property Verbs As WebPartVerbCollection

属性值

包含自定义 WebPartVerbCollection 对象的 WebPartVerb

示例

下面的代码示例演示如何使用 Verbs 在用户控件中实现的 属性。 此代码示例的完整代码可在类概述主题的 IWebActionable “示例”部分找到。

代码示例的以下部分演示了用户控件中 属性的 Verbs 自定义实现。

// This property implements the IWebActionable interface.
WebPartVerbCollection IWebActionable.Verbs
{
  get
  {
    if (m_Verbs == null)
    {
      ArrayList verbsList = new ArrayList();
      WebPartVerb onlyVerb = new WebPartVerb
        ("customVerb1", new WebPartEventHandler(IncrementVerbCounterClicks));
      onlyVerb.Text = "My Verb";
      onlyVerb.Description = "VerbTooltip";
      onlyVerb.Visible = true;
      onlyVerb.Enabled = true;
      verbsList.Add(onlyVerb);
      WebPartVerb otherVerb = new WebPartVerb
        ("customVerb2", new WebPartEventHandler(IncrementVerbCounterClicks));
      otherVerb.Text = "My other Verb";
      otherVerb.Description = "Other VerbTooltip";
      otherVerb.Visible = true;
      otherVerb.Enabled = true;
      verbsList.Add(otherVerb);
      m_Verbs = new WebPartVerbCollection(verbsList);
      return m_Verbs;
    }
    return m_Verbs;
  }
}
' This property implements the IWebActionable interface.
ReadOnly Property Verbs() As WebPartVerbCollection _
  Implements IWebActionable.Verbs
  Get
    If (m_Verbs Is Nothing) Then
      Dim verbsList As New ArrayList()
      Dim onlyVerb As New WebPartVerb _
        ("customVerb1", New WebPartEventHandler(AddressOf IncrementVerbCounterClicks))
      onlyVerb.Text = "My Verb"
      onlyVerb.Description = "VerbTooltip"
      onlyVerb.Visible = True
      onlyVerb.Enabled = True
      verbsList.Add(onlyVerb)
      Dim otherVerb As New WebPartVerb _
        ("customVerb2", New WebPartEventHandler(AddressOf IncrementVerbCounterClicks))
      otherVerb.Text = "My other Verb"
      otherVerb.Description = "Other VerbTooltip"
      otherVerb.Visible = True
      otherVerb.Enabled = True
      verbsList.Add(otherVerb)
      m_Verbs = New WebPartVerbCollection(verbsList)
    End If
    Return m_Verbs
  End Get
End Property

注解

属性 Verbs 引用自定义谓词的集合, (添加到 或其他服务器控件的 标头 WebPart 中的谓词菜单中的任何) 。 集合Verbs不包含对 Web 部件控件集提供的标准WebPartVerb对象的引用,例如 CloseVerbDeleteVerbEditVerbRestoreVerb、 或 MinimizeVerb

想要将自定义谓词添加到派生自 类的自定义控件的 WebPart 开发人员只需重写 VerbsWebPart 实现的属性即可。

想要将自定义谓词添加到用户控件或不是WebPart控件的自定义控件的开发人员必须通过提供 属性的Verbs实现来实现 IWebActionable 接口。

适用于

另请参阅