Parameters
- pagePoint
- The point in page coordinates
Return Value
A point in map coordinates
| Exception | Description |
|---|---|
| System.InvalidOperationException | Mapframe must contain a 2D map |
| System.ArgumentNullException | pagePoint |
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
var pointSymbol = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.BlackRGB, 8);
var graphicsLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<GraphicsLayer>().FirstOrDefault();
//Note: Must be on QueuedTask.Run
//Get a point in the center of the Map frame
var mapFrameCenterPoint = mapFrame.GetBounds().CenterCoordinate;
//Convert to MapPoint
var pointInMapFrame = MapPointBuilderEx.CreateMapPoint(mapFrameCenterPoint);
//Find the corresponding point in the MapView
var pointOnMap = mapFrame.PageToMap(pointInMapFrame);
//Create a point graphic on the MapView.
var cimGraphicElement = new CIMPointGraphic
{
Location = pointOnMap,
Symbol = pointSymbol.MakeSymbolReference()
};
graphicsLayer.AddElement(cimGraphicElement);
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)