ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Presentations.Events Namespace / PresentationEvent Class / Subscribe Method
The delegate that gets executed when the event is published.
When false the CompositePresentationEvent will maintain a weak delegate reference to the subscriber. Using a weak delegate reference relieves the subscriber from the need to unsubscribe to enable proper garbage collection. The default is false.
Example

In This Topic
    Subscribe Method (PresentationEvent)
    In This Topic
    Subscribe to the PresentationEvent.
    Syntax

    Parameters

    action
    The delegate that gets executed when the event is published.
    keepSubscriberAlive
    When false the CompositePresentationEvent will maintain a weak delegate reference to the subscriber. Using a weak delegate reference relieves the subscriber from the need to unsubscribe to enable proper garbage collection. The default is false.

    Return Value

    A SubscriptionToken that uniquely identifies the added subscription.
    Example
    Detect changes to the presentation
    {
      ArcGIS.Desktop.Presentations.Events.PresentationEvent.Subscribe((args) =>
      {
        var presentation = args.Presentation; //The presentation that was changed
    
        //Check what triggered the event and take appropriate action
        switch (args.Hint)
        {
          case PresentationEventHint.PropertyChanged:
            //TODO handle presentation property changed
            break;
          case PresentationEventHint.PageAdded:
            //TODO handle a new page added
            break;
          case PresentationEventHint.PageRemoved:
            //TODO handle a page removed from the presentation
            break;
          case PresentationEventHint.PageSettingChanged:
            //TODO handle page settings changed
            break;
        }
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.5 or higher.
    See Also