private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
{
ClearGraphicsLayers();
Graphic graphic = new Graphic();
if (args.Geometry is MapPoint)
graphic.Symbol = LayoutRoot.Resources["BlueMarkerSymbol"] as SimpleMarkerSymbol;
else if (args.Geometry is Polyline)
graphic.Symbol = LayoutRoot.Resources["BlueLineSymbol"] as SimpleLineSymbol;
else if (args.Geometry is Polygon)
graphic.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as SimpleFillSymbol;
else if (args.Geometry is Envelope)
graphic.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as SimpleFillSymbol;
if (graphic.Symbol != null)
{
graphic.Geometry = args.Geometry;
_myToJsonGraphicsLayer.Graphics.Add(graphic);
}
// Convert from Geometry to ArcGIS REST geometry json
OutJsonTextBox.Text = args.Geometry.ToJson();
}