You must be referring to MeasureAction. The GraphicsLayer that contains the polygon used for Measure is added to the map once Measure is started and removed from the map once Measure has completed. If you need this polygon to stay in your map, you need to create your own GraphicsLayer and add a copy of this polygon to your GraphicsLayer. Maybe do something like the following: Note, however, that this code will be executed everytime a new layer is added to your map. You might need to tweak this to handle when you subscribe/unsubscribe to Graphics.CollectionChanged event.Xaml-code:
<esri:Map x:Name="MyMap">
<esri:ArcGISTiledMapServiceLayer ID="MyBaseLayer"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
<esri:GraphicsLayer ID="MyGraphicsLayer"/>
</esri:Map>
Code-behind:
this.MyMap.Layers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Layers_CollectionChanged);
}
void Layers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach(var item in e.NewItems)
if(item is GraphicsLayer)
(item as GraphicsLayer).Graphics.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Graphics_CollectionChanged);
}
}
void Graphics_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
GraphicsLayer graphicsLayer = this.MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
if (graphicsLayer != null)
{
foreach (var item in e.NewItems)
{
if (item is Graphic)
{
Graphic g = item as Graphic;
graphicsLayer.Graphics.Add(new Graphic() { Geometry = g.Geometry, Symbol = g.Symbol });
}
}
}
}
}