ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Presentations Namespace / PresentationView Class / Presentation Property
Example

In This Topic
    Presentation Property (PresentationView)
    In This Topic
    Gets the presentation associated with the presentation view.
    Syntax
    public Presentation Presentation {get;}
    Public ReadOnly Property Presentation As Presentation
    Example
    Reference an existing presentation
    {
      //Reference a presentation associated with an active presentation view
      PresentationView associatedPresentationView = PresentationView.Active;
      if (activePresentationView != null)
      {
        Presentation presentationExisting = activePresentationView.Presentation;
      }
    }
    Activate a presentation view
    {
      //Assume we want to open a view for a particular presentation or activate a view if one is already open
    
      //A presentation project item is an item that appears in the Presentation folder in the Catalog pane.
      PresentationProjectItem presentationItem = Project.Current.GetItems<PresentationProjectItem>()
                                                 .FirstOrDefault(item => item.Name.Equals("Presentation Name"));
      //Reference a presentation associated with a presentation project item
      if (presentationItem != null)
      {
        //Get the presentation associated with the presentationItem
        Presentation presentationToOpen = await QueuedTask.Run(() => presentationItem.GetPresentation());
    
        //Next check to see if a presentation view is already open that references the presentation
        foreach (var pane in ProApp.Panes)
        {
          var prePane = pane as IPresentationPane;
          if (prePane == null)  // Not a presentation view, continue to the next pane
          {
            continue;
          }
    
          //if there is a match, activate the view
          if (prePane.PresentationView.Presentation == presentationToOpen)
          {
            (prePane as Pane).Activate();
            return;
          }
        }
    
        //No pane found, activate a new one - must be called on UI
        IPresentationPane iNewPresentationPane = await ProApp.Panes.CreatePresentationPaneAsync(presentationToOpen); //GUI thread
      }
    }
    Blank page
    {
      Presentation presentationActive = PresentationView.Active.Presentation;
      await QueuedTask.Run(() =>
      {
        // add a blank page with with title and paragraph body text element
        presentation.AddBlankPage(BlankPageTemplateType.TitleAndParagraph, -1);
      });
    }
    Change map page camera settings
    {
      await QueuedTask.Run(() =>
      {
        //Reference a map page
        var mpage = activePresentationView.Presentation.GetPage(4) as MapPresentationPage;
    
        //Set the map frame extent based on the new camera's X,Y, Scale and heading values
        Camera cam = new Camera(329997.6648, 6248553.1457, 2403605.8968, 24);
        mpage.SetCamera(cam);
      });
    }
    Zoom map page to extent of a single layer
    {
      await QueuedTask.Run(() =>
      {
        //Reference map page
        var mpage = activePresentationView.Presentation.GetPage(4) as MapPresentationPage;
    
        //Reference map and layer
        MapProjectItem mp = Project.Current.FindItem("Page name") as MapProjectItem;
        Map map = mp.GetMap();
        FeatureLayer lyr = map.FindLayers("GreatLakes").First() as FeatureLayer;
    
        //Set the map frame extent to all features in the layer
        mpage.SetCamera(lyr);
      });
    }
    Presentation page design
    {
      // create customized margin and color
      CIMMargin pMargin = new CIMMargin() { Left = 0.2, Right = 0.3, Top = 0.15, Bottom = 0.25 };
      CIMRGBColor pColor = new CIMRGBColor() { R = 255, G = 255, B = 0, Alpha = 50 };
    
      //Reference a page and its transition
      var pageReference = activePresentationView.Presentation.GetPage(0);
      CIMPresentationTransition transition = page.Transition;
    
      // update the transition style
      transition.TransitionType = PresentationTransitionType.Swipe;
      transition.Duration = 2.0;
      transition.SwipeDirection = SwipeDirection.Top;
    
      await QueuedTask.Run(() =>
      {
        //Set the new margin, new background color and new transition effect
        page.SetMargin(pMargin);
        page.SetBackgroundColor(pColor);
        page.SetTransition(transition);
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.5 or higher.
    See Also