Hi,
I am using the SketchEditor.StartAsync(CreationMode.Rectangle, false) to draw a rectangle on a map by dragging the mouse. I added the abaility to cancel the sketch by pressing Escape and this cancels the drawing as I expected. However, when I try to draw another rectangle, nothing shows up and the geometry returned by StartAsync is null. After this, I can draw another rectangle, but the first time I try to draw after cancelling, this happens. Is there any way around this?
Thanks,
Keith
Sounds like a bug. Any chance you can share a small sample showing how you did this, so we can try and reproduce it and hopefully make a fix?
private async void MyMapView_MouseDown(object sender, System.Windows.Input.MouseEventArgs e)
{
try
{
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
{
SimpleLineSymbol line = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Red, 2);
SimpleFillSymbol fill = new SimpleFillSymbol(
SimpleFillSymbolStyle.Solid, System.Drawing.Color.FromArgb(Convert.ToInt32("0x55", 16),
Convert.ToInt32("0xB0", 16), Convert.ToInt32("0xC4", 16), Convert.ToInt32("0xDE", 16)), line);
this.MyMapView.SketchEditor.Style.FillSymbol = fill;
this.MyMapView.SketchEditor.Style.LineSymbol = line;
var rect = await this.MyMapView.SketchEditor.StartAsync(Esri.ArcGISRuntime.UI.SketchCreationMode.Rectangle, false);
if (rect != null)
{
await this.MyMapView.SetViewpointGeometryAsync(rect);
}
}
}
catch (TaskCanceledException)
{
//Ignore
}
}
private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == System.Windows.Input.Key.Escape)
{
if (this.MyMapView.SketchEditor.CancelCommand.CanExecute(null))
{
this.MyMapView.SketchEditor.CancelCommand.Execute(null);
}
}
}
This is the code I am using.
Thanks