ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / SetClipGeometry Method / SetClipGeometry(Polygon,CIMLineSymbol) Method
The clip polygon
The border symbol to use or null
Example Version

SetClipGeometry(Polygon,CIMLineSymbol) Method
Set map clipping to the provided clip polygon. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetClipGeometry( 
   Polygon clipPolygon,
   CIMLineSymbol border
)

Parameters

clipPolygon
The clip polygon
border
The border symbol to use or null
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
clipPolygon cannot be null
Remarks
If the clip polygon is not in the spatial reference of the map it will be projected. Clipping will be set to ArcGIS.Core.CIM.ClippingMode.CustomShape. If the border symbol is null then the existing ArcGIS.Core.CIM.CIMMap.ClippingAreaBorderSymbol will be used. If ClippingAreaBorderSymbol is also null then a default line symbol will be assigned.
Example
Clip Map to the provided clip polygon
//Run within QueuedTask
var map = MapView.Active.Map;
//A layer to use for the clip extent
var lyrOfInterest = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.Name == "TestPoly").FirstOrDefault();
//Get the polygon to use to clip the map
var extent = lyrOfInterest.QueryExtent();
var polygonForClipping = PolygonBuilderEx.CreatePolygon(extent);
//Clip the map using the layer's extent
map.SetClipGeometry(polygonForClipping,
      SymbolFactory.Instance.ConstructLineSymbol(
      SymbolFactory.Instance.ConstructStroke(
        ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Dash)));
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also