

Public Class PresentationPage Inherits ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase Implements ArcGIS.Desktop.Mapping.IElementContainer, System.ComponentModel.INotifyPropertyChanged
public class PresentationPage : ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase, ArcGIS.Desktop.Mapping.IElementContainer, System.ComponentModel.INotifyPropertyChanged
{
//Note: Must be on the QueuedTask
//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);
}
{
//Note: Must be on the QueuedTask
//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);
}
{
//Note: Must be on QueuedTask
// Find specific elements by name
var ge_rect = page.FindElement("Rectangle") as GraphicElement;
var elements = new List<string>();
elements.Add("Text");
elements.Add("Polygon");
var elems = page.FindElements(elements);
//Get elements retaining hierarchy
var top_level_elems = page.GetElements();
//Flatten hierarchy
var all_elems = page.GetFlattenedElements();
//Use LINQ with any of the collections
//Retrieve just those elements that are Visible
var some_elems = all_elems.Where(ge => ge.IsVisible).ToList();
}
{
//Note: Must be on QueuedTask
//Select/unselect some elements...
var elems = activePage.GetFlattenedElements();
//select any element not a group element
activePage.SelectElements(elems.Where(e => !e.Name.StartsWith("Group")));
activePage.UnSelectElements(elems.Where(e => !e.Name.StartsWith("Group")));
//Select/unselect all visible, graphic elements
var ge_elems = elems.Where(ge => ge.IsVisible).ToList();
activePage.SelectElements(ge_elems);
activePage.UnSelectElements(ge_elems);
//Select/unselect a specific element
var na = activePage.FindElement("My Text Element");
activePage.SelectElement(na);
activePage.UnSelectElement(na);
//Select everything
activePage.SelectElements(elems);
//enumerate the selected elements
foreach (var sel_elem in activePage.GetSelectedElements())
{
//TODO
}
}
System.Object
ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
ArcGIS.Desktop.Presentations.PresentationPage
ArcGIS.Desktop.Presentations.ImagePresentationPage
ArcGIS.Desktop.Presentations.MapPresentationPage
ArcGIS.Desktop.Presentations.VideoPresentationPage
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)