Inherit this abstract class to create a button that can appear on toolbars or menus.

Namespace:  ESRI.ArcGIS.Desktop.AddIns

Assembly:  ESRI.ArcGIS.Desktop.Addins (in ESRI.ArcGIS.Desktop.Addins.dll) Version: 10.0.0.0 (10.0.0.0)

Syntax

C#
public abstract class Button : IDisposable
Visual Basic (Declaration)
Public MustInherit Class Button _
	Implements IDisposable
Visual C++
public ref class Button abstract : IDisposable

Remarks

The simplest way to create a new Button is to use the templates provided in the ArcObjects SDK for .NET. For step by step instructions on creating a new Button using these templates, see the Creating a custom Button walkthrough.

Examples

The example code below shows a very simple button class that shows a dockable window.
CopyC#
public ToggleDockWndBtn() 
{
  this.Checked = true;
}

protected override void OnClick()
{
  //Get dockable window.
  UID dockWinID = new UIDClass();
  dockWinID.Value = @"esriArcMapUI.TOCDockableWindow";
  IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
  dockWindow.Show(!dockWindow.IsVisible());
}

protected override void OnUpdate()
{
  this.Enabled = m_mainExtension.IsExtensionEnabled;
}
CopyVB.NET
Public Sub New()
  Me.Checked = True
End Sub

Protected Overloads Overrides Sub OnClick()
  'Get dockable window. 
  Dim dockWinID As UID = New UIDClass()
  dockWinID.Value = "esriArcMapUI.TOCDockableWindow"
  Dim dockWindow As IDockableWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID)
  dockWindow.Show(Not dockWindow.IsVisible())
End Sub

Protected Overloads Overrides Sub OnUpdate()
  Me.Enabled = m_mainExtension.IsExtensionEnabled
End Sub

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGIS.Desktop.AddIns..::.Button

See Also