This is an archive related to a previous version of Esri Maps for SharePoint. If you need the current version go to

Best practices: Graphics layers, symbols, and renderers

Using the ArcGIS API for Silverlight, you can dynamically display graphics on a map through a Graphics Layer. A Graphics Layer could, for example, be used to hold polygons drawn by a user or display features that satisfy a user-defined query.

Symbols define all the nongeographic aspects of a graphic's appearance. This includes a graphic's color, border width, transparency, and more. The ArcGIS API for Silverlight includes many symbol classes, each of which allows you to specify symbology in a unique way. Each symbol type is also specific to one geometry type (that is, point, line, or polygon).

Renderers define one or more symbols to apply to a Graphics Layer. The symbol applied to each graphic depends on the graphic's attributes. The renderer specifies which attribute values correspond to which symbol.

The following sections detail several best practices for working with a Graphics Layer, symbols, and renderers.

Set the GraphicsLayer.Renderer property

You must use the GraphicsLayer.Renderer property to set the layer’s symbology. If the Renderer property is not set when a Graphics Layer is added to the map, the ArcGIS Map Web Part automatically populates this property with a default renderer; therefore, you should set the GraphicsLayer.Renderer property before the layer is added to the map. A Graphics Layer’s Renderer property always overrides any symbols set via Graphic.Symbol.

GraphicsLayer gl = new GraphicsLayer()
    ID = "IdentifyResultsLayer",
    Renderer = new SimpleRenderer()
          Symbol = identifyDialog.Resources["RedMarkerSymbol"] as Symbol

Supported renderers

Only UniqueValueRenderer, ClassBreaksRenderer, and SimpleRenderer are currently supported for persistence and configuration. If an unsupported renderer type is used, users will not be able to configure the symbology of the results layer after it has been added to the map. As an example, consider a tool that adds a Graphics Layer to the map. It is possible for users to run such a tool while they are editing the Map Web Part. If they use a supported renderer type, users can configure the symbology of the results layer after it has been added to the map. Additionally, if they save or deploy that application, the results layer will be stored as part of that application’s map. These capabilities will not be available on Graphics Layers that use renderer types that do not support persistence and configuration (for example, TemporalRenderer).

If a renderer type other than UniqueValueRenderer, ClassBreaksRenderer, or SimpleRenderer is used, do not allow the tool to be executed from within the Application Builder, because types other than these do not support persistence and configuration. To do this, check whether Application.Current.IsEditMode is true, and, if so, prevent the tool from being run.

GraphicsLayer symbols

Declare the symbols used in your Graphics Layer in a resource collection within your UI’s XAML. While symbols can be created programmatically, declaring them in XAML is more concise, more readable, and generally easier to maintain.

       <esri:SimpleMarkerSymbol x:Key="RedMarkerSymbol" Color="Red" Size="12" Style="Circle" />

Layer name

To retrieve or set the layer name that is shown in the Map Contents panel, use MapApplication.LayerNameProperty. You can set the name by calling Layer.SetValue(MapApplication.LayerNameProperty, “layer name”), and retrieve the name by calling Layer.GetValue(MapApplication.LayerNameProperty).

GraphicsLayer gl = new GraphicsLayer();
gl.SetValue(MapApplication.LayerNameProperty, "Identify Results");