I am not able to stop drawing even with your suggestions. The surface is still receiving drawings. I have a button event that triggers the draw surface. I would like to stop drawing at the end of the first polygon. This is my code. Anything wrong?
private void StartPolygon_Click(object sender, RoutedEventArgs e)
{
Draw myDrawObject = new Draw(this.baseMap)
{
LineSymbol = this.layoutMap.Resources["DrawLineSymbol"] as LineSymbol,
FillSymbol = this.layoutMap.Resources["DrawFillSymbol"] as FillSymbol
};
myDrawObject.DrawMode = DrawMode.Polygon;
myDrawObject.DrawComplete += myDrawObject_OnDrawComplete;
myDrawObject.IsEnabled = (myDrawObject.DrawMode != DrawMode.None);
}
private void myDrawObject_OnDrawComplete(object sender, DrawEventArgs args)
{
//here I save the graphics and then to stop drawing I say
Draw myDrawObject = new Draw(this.baseMap)
myDrawObject.DrawMode = DrawMode.None
}