PushButton Class

The PushButton object represents an button on a RibbonPanel.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.UIRibbonItem
    Autodesk.Revit.UIRibbonButton
      Autodesk.Revit.UIPushButton
        Autodesk.Revit.UIToggleButton

Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class PushButton : RibbonButton

The PushButton type exposes the following members.

Properties
 NameDescription
Public propertyAssemblyNameThe assembly path of the button.
Public propertyAvailabilityClassNameThe full class name for the class providing the entry point to decide availability of this push button.
Public propertyClassNameThe name of the class containing the implementation for the command.
Public propertyEnabledGets or sets a value indicating whether the item is enabled.
(Inherited from RibbonItem)
Public propertyImageThe image of the button.
(Inherited from RibbonButton)
Public propertyIsEnabledByContextIndicates if this button can be executed. True if the pushbutton is permitted to be executed based on the current Revit context (active document, active view and active tool). False if the pushbutton is disabled because of the active context.
(Inherited from RibbonButton)
Public propertyItemTextGets or sets the text displayed on the item.
(Inherited from RibbonItem)
Public propertyItemTypeGets the item type.
(Inherited from RibbonItem)
Public propertyLargeImageThe large image shown on the button.
(Inherited from RibbonButton)
Public propertyLongDescription Long description of the command tooltip
(Inherited from RibbonItem)
Public propertyNameThe name of the item.
(Inherited from RibbonItem)
Public propertyToolTipThe description that appears as a ToolTip for the item.
(Inherited from RibbonItem)
Public propertyToolTipImageThe image to show as a part of the button extended tooltip
(Inherited from RibbonItem)
Public propertyVisibleGets or sets a value indicating whether the item is visible.
(Inherited from RibbonItem)
Top
Methods
 NameDescription
Public methodEquals Determines whether the specified Object is equal to the current Object.
(Inherited from RibbonItem)
Public methodGetContextualHelpGets the contextual help bound with this control.
(Inherited from RibbonItem)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodSetContextualHelpSets the contextual help bound with this button.
(Inherited from RibbonItem)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks
Use of this class is not supported in Revit Macros.
Example
private void AddPushButton(RibbonPanel panel)
{
    PushButton pushButton = panel.AddItem(new PushButtonData("HelloWorld",
        "HelloWorld", @"D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll", "HelloWorld.CsHelloWorld")) as PushButton;

    // Set ToolTip and contextual help
    pushButton.ToolTip = "Say Hello World";
    ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url,
        "http://www.autodesk.com");
   pushButton.SetContextualHelp(contextHelp);

    // Set the large image shown on button
    pushButton.LargeImage = 
        new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png"));
}
See Also