Search code examples
sdkadd-inarcgis

How can one customize the ArcGIS Pro OverviewMapControl add-in?


I have downloaded the community samples, installed SDK and run the solution successfully in Visual Studio to use the default add-in. I am now interested in customizing the control to:

1) display specific layers (not all of the active/displayed layers)

2) open to a specified zoom extent.

I have located some of the snippets on the git site (zoom to extent specifically) but do not know how to format the coordinates and am unclear as to what heading they go under. I cannot find related code to mimic and am unfamiliar with coding in C# (pretty well versed in python and AHK). Any help or resources would be GREATLY appreciated. Thanks in advance!


Solution

  • I got this response, for those who are interested: see thread here

    1. MapControl has a ViewContent property that can be set to any custom view content. In the sample, I am using the MapControlContentFactory.Create method to set the view content (within the InitializeMapControl method in MapControlDockpane.xaml.cs). This Create method has many overloads. This particular overload might be exactly what you need: (Note the first parameter which takes a list of any layers you need)

    Create Method: http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic12607.html

    public static MapControlContent Create( IEnumerable layers, Envelope initialExtent, MapViewingMode viewingMode )

    1. MapControl's zoom extent is also defined when you create the content using the Create method (the envelope parameter). In the sample, I am listening to the ActiveMapViewChangedEvent and MapViewCameraChangedEvent events and modifying the MapControl's extent to match that. You can remove that for your workflow and set the MapControl's content the way you want it to be.