GraphicsLayer's AddElement extension method not recognized

498
1
09-17-2020 12:30 PM
AlexZlotin1
New Contributor III

I am trying to add a graphics element to a graphics layer using Pro SDK 2.6. For some reason the AddElement method and the other extension methods that come from GraphicsLayerExtensions are not recognized. Visual Studio reports the following: 'GraphicsLayer' does not contain a definition for 'AddElement' and no accessible extension method 'AddElement' accepting a first argument of type 'GraphicsLayer' could be found (are you missing a using directive or an assembly reference?). Is there a reference that needs to be added? Thanks!

GraphicsLayer graphicsLayer = GetGraphicsLayer();

CIMLineGraphic lineGraphic = new CIMLineGraphic() { Symbol = lineSymbol, Line = polyline };
graphicsLayer.AddElement(lineGraphic);

0 Kudos
1 Reply
AlexZlotin1
New Contributor III

Found the answer with colleague's help. The missing reference was ArcGIS.Desktop.Layouts.

0 Kudos