Reputation: 1618
Following code, doesn't get triggered when Esc is pressed. Can somebody give me insight? I like to change the cursor (let's say from drawing mode turn it into pointer mode)
public override void OnKeyDown(MyCanvas dc, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
_line = null;
e.Handled = true;
}
}
Thanks.
Upvotes: 0
Views: 59
Reputation: 28718
@amit's solution:
public override void OnKeyDown(MyCanvas dc, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
_line = null;
dc.CurrentTool = ToolType.Pointer;
dc.Cursor = Cursors.Arrow;
dc.ReleaseMouseCapture();
}
}
Upvotes: 2