ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TrayButton Class / CanAutoClose Property

In This Topic
    CanAutoClose Property
    In This Topic
    Gets or sets whether or not a Popup can automatically close when user moves the mouse outside the bounds of the popup.
    Syntax
    public bool CanAutoClose {get; set;}
    Public Property CanAutoClose As Boolean
    Remarks

    Only available if ButtonType is TrayButtonType.PopupToggleButton

    Just before the popup is opened, CanAutoClose is preset to the default value true, meaning that the popup automatically closes when a user moves the mouse outside the bounds of the popup.

    Subclasses can set this property to the value false, after the popup has been opened in order to suppress the auto-closing behavior.

    This might be important if a control within the popup displays another popup, an end user clicks in that popup, leading to the mouse leaving the bounds of the tray button popup. In this scenario, subclass must be careful to set CanAutoClose to false when the popup opens, and reset CanAutoClose to true once the popup closes.

    An example of where this behavior is necessary is, a tray button popup contains a ComboBox with drop-down popup. When a user activates the drop-down, it is possible for the drop-down to extend beyond the boundary of the tray popup. After user clicks in the ComboBox drop-down, the mouse may now be outside the tray popup boundary and, without using this property to prevent it, the tray code will assume that user wants the popup closed. Subclass code should ensure that CanAutoClose is set to false just after the ComboBox popup has been opened, and set to true just after the ComboBox popup has been closed.

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also