ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TrayButton Class
Members Example

In This Topic
    TrayButton Class
    In This Topic
    Represents a button that can be added to the ArcGIS Pro Tray.
    Object Model
    TrayButton ClassRelayCommand ClassPane Class
    Syntax
    Remarks

    This base class can be used to create buttons that appear in the tray area of every MapView and ArcGIS.Desktop.Layouts.LayoutView. It provides virtual methods that can be overriden to perform actions during the life cycle of this button.

    Specify the type of desired button by setting ButtonType within either an overridden constructor or Initialize. After Initialize has been invoked, the underlying UI Button will be fixed for the lifetime of the associated view.

    If ButtonType has been set to TrayButtonType.Button then ClickCommand should also be set - it will be invoked whenever the UI button is clicked.

    If ButtonType has been set to TrayButtonType.ToggleButton then OnButtonChecked will be invoked whenever the UI button's Checked state is changed.

    If ButtonType has been set to TrayButtonType.PopupToggleButton then OnButtonChecked will be invoked whenever the UI button's Checked state is changed. In addition, a customizable popup window will be displayed whenever the mouse is hovered over the button. Override ConstructPopupContent to provide the content that will be displayed in the popup.

    To add to the tray of a MapView, add a TrayButton component to the "esri_mapping_MapTrayButtons" category within DAML.

    To add to the tray of a LayoutView, add a TrayButton component to the "esri_layouts_LayoutTrayButtons" category within DAML.

    Example

    A sample UpdateCategory needs to be presented here.

    Here is a copy of the Snapping InsertCategory.

    <insertCategory id="esri_mapping_MapTrayButtons">
      <component id="esri_mapping_SnappingTrayButton" className="ArcGIS.Desktop.Internal.Mapping.Controls.SnappingControl.SnappingTrayButton">
          <content L_name="Snapping"
          largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/ContentsWindowListBySnapping32.png"
          smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/ContentsWindowListBySnapping16.png"
          L_tooltipHeading="Snapping"
          L_tooltip="Turn snapping on or off for interactive tools." />
      </component>
    </insertCategory>
    Inheritance Hierarchy
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also