共用方式為


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 Example 區段中找到此程式碼範例的完整程式碼。

下列程式代碼範例部分示範使用者控件內 屬性的自定義實作 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 物件的參考,例如 CloseVerbDeleteVerbEditVerbRestoreVerbMinimizeVerb

想要將自定義動詞新增至衍生自 類別之自定義控件的 WebPart 開發人員,可以直接覆寫 Verbs 類別實作的屬性 WebPart

想要將自定義動詞新增至使用者控件或不是 WebPart 控件的自定義控件的開發人員,必須藉由提供 屬性的實作來實 IWebActionableVerbs 介面。

適用於

另請參閱