ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Framework.Events Namespace / ActiveToolChangedEvent Class / Subscribe Method
The method to call.
Subscribe with a strong reference. Default is false (weak reference).
Example

In This Topic
    Subscribe Method (ActiveToolChangedEvent)
    In This Topic
    Call the specified method whenever the event occurs.
    Syntax
    Public Shared Function Subscribe( _
       ByVal action As Action(Of ToolEventArgs), _
       Optional ByVal keepSubscriberAlive As Boolean _
    ) As SubscriptionToken

    Parameters

    action
    The method to call.
    keepSubscriberAlive
    Subscribe with a strong reference. Default is false (weak reference).

    Return Value

    A SubscriptionToken that can be used to unsubscribe with.
    Example
    Subscribe to Active Tool Changed Event
    private void SubscribeEvent()
    {
      ArcGIS.Desktop.Framework.Events.ActiveToolChangedEvent.Subscribe(OnActiveToolChanged);
    }
    private void UnSubscribeEvent()
    {
      ArcGIS.Desktop.Framework.Events.ActiveToolChangedEvent.Unsubscribe(OnActiveToolChanged);
    }
    private void OnActiveToolChanged(ArcGIS.Desktop.Framework.Events.ToolEventArgs args)
    {
      string prevTool = args.PreviousID;
      string newTool = args.CurrentID;
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also