What is a graphics layer

Graphics layers allow you to display graphics on a map. Graphics can have point, polyline, and polygon geometries. A graphics layer can, for example, be used to hold polygons drawn by a user or display features that satisfy a user-defined query or showing a real-time Global Positioning System (GPS) location. Graphics in a graphics layer are stored in memory and are only available while the application is running. Graphics layers are therefore very well suited to displaying large numbers of symbols which are updated in a real time environment.

When a feature is drawn in the graphics layer, it will have a number of properties set that will define its appearance. The feature's geometry and attributes, combined with symbol properties, is known as a graphic. Graphics are assigned to a graphics layer where they are rendered.

When you create a Windows Presentation Foundation (WPF) mapping application, Graphics can either be declared in XAML or in code behind. If declaring a GraphicsLayer in XAML, be sure to specify the graphics layer below any base layers so that when the XAML is parsed the graphics will display above the base layers when you run the application. If adding Graphics in code behind you can add them individually to a GraphicsLayer via the GraphicsCollection.Add() method if you are working with small numbers of Graphics, but if working with many Graphics it is much more efficient to add them to a generic collection (e.g. List<Graphic>) and then use the GraphicsCollection.AddRange() method to add them to the layer. Alternatively, you might want to consider using the GraphicsSource property of the GraphicsLayer which benefits from the same optimizations. For more information, see How to add a graphics layer and How to add features to a graphics layer.

1/27/2015