I am updating this sample to mimic what you are trying to do in your Silverlight app: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ProjectI added the following resource:
<esri:SimpleLineSymbol x:Key="DrawLineSymbol" Color="Green" Width="4" />
<esri:SimpleFillSymbol x:Key="DrawFillSymbol" Fill="#3300FF00" BorderBrush="Green" BorderThickness="2" />
<esri:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="#33FF0000" BorderBrush="Red" BorderThickness="2" />
Added a button to complete draw:
<Button Content="Complete" Margin="0,5,5,0" Click="Button_Click" />
And the following code InitializeComponent():
draw = new Draw(MyMap)
{
LineSymbol = LayoutRoot.Resources["DrawLineSymbol"] as LineSymbol,
FillSymbol = LayoutRoot.Resources["DrawFillSymbol"] as FillSymbol,
DrawMode = DrawMode.Polygon,
IsEnabled = true
};
draw.DrawComplete += draw_DrawComplete;
}
Draw draw;
void draw_DrawComplete(object sender, DrawEventArgs e)
{
graphicsLayer.Graphics.Add
(new Graphic()
{
Geometry = e.Geometry,
Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as Symbol
});
MyMap.PanTo(e.Geometry);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
draw.CompleteDraw();
draw.IsEnabled = false;
}
I modified the code to add vertex instead of adding graphic to the map:
draw.AddVertex(resultMapPoint);
//graphicsLayer.Graphics.Add(resultGraphic);
I think this is what you are trying to do but I did not get application to freeze.