private void OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            ImageHostGrid.ReleaseMouseCapture();

            var location = e.GetPosition(ImageHostGrid);

            // A 'click' happens if we MouseUp less than 5 pixels from where we MouseDown
            if (Math.Abs(location.X - mouseDownLocation.X) < 5 && Math.Abs(location.Y - mouseDownLocation.Y) < 5)
            {
                viewModel.GridSingleClick(location);
            }
        }
 private void OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     mouseLastLocation = mouseDownLocation = e.GetPosition(ImageHostGrid);
     ImageHostGrid.CaptureMouse();
 }