Hi,@Don Baechtel. Welcome Microsoft Q&A.
In my experience, it seems to take a mouse click to realize that the mouse pointer has actually left a control. You could write cnv.ReleaseMouseCapture()
in the cnv_MouseLeftButtonDown
method.
private void Canvas_MouseEnter(object sender, MouseEventArgs e)
{
Canvas cnv = sender as Canvas;
Mouse.Capture(cnv);
croshairs.Visibility = Visibility.Visible;
}
private void Canvas_MouseLeave(object sender, MouseEventArgs e)
{
Canvas ch = null;
foreach (UIElement ui in area.Children)
{
if (ui.Uid == "croshairs")
{
ch = ui as Canvas;
ch.Visibility = Visibility.Hidden;
break;
}
}
canvas.Background =Brushes.Green ;
}
private void cnv_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Canvas cnv = sender as Canvas;
cnv.ReleaseMouseCapture();
}
The result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.