AnsweredAssumed Answered

GraphicsLayer Spatial Reference

Question asked by keremcelik on May 2, 2011
Latest reply on Aug 7, 2015 by skutz

I want to add a graphics layer in Map. But this layer is lack of Spatial Reference. I cannot specify the spatial reference, because it's property is read only(just get is implemented in the API).

Here is xaml (It is generated when I create an ESRI SL Application in Visual Studio)
<esri:Map x:Name="Map" Background="White">
             <esri:ArcGISTiledMapServiceLayer ID="BaseLayer"

I want to create Graphics Layer with the following code behind C# code
public GraphicsLayer CreatePointGraphicLayer(string ID,
            SpatialReference spatial_reference,
            List<double> x_list,
            List<double> y_list,
            List<string> fields,
            List<string[]> other_fields_values)
 GraphicsLayer graphics_layer = new GraphicsLayer();
 graphics_layer.ID = ID;

 SimpleMarkerSymbol simple_marker_symbol = new SimpleMarkerSymbol();
 simple_marker_symbol.Color = new SolidColorBrush(Colors.Red);

 for (int i = 0; i < x_list.Count; i++)
  Graphic graphic = new Graphic()
   Symbol = simple_marker_symbol,
   Geometry = new MapPoint(x_list[i], y_list[i], spatial_reference)

  for (int j = 0; j < fields.Count; j++)
   graphic.Attributes[fields[j]] = other_fields_values[i][j];


 return graphics_layer;

The code above create the graphics layer and when I put it into Map with the following lines of code, I can see the created graphics but lack of spatial reference.

GraphicsLayer g_layer = CreatePointGraphicLayer(....) //I omit this part

How can I use spatial reference in graphics layer.

Thanks in advance.