private void ImagePreview_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Middle)
     {
         ImagePreviewCanvas.ReleaseMouseCapture();
         ImagePreviewCanvas.SetCurrentValue(CursorProperty, Cursors.Arrow);
         var tt = (TranslateTransform)((TransformGroup)ImagePreview.RenderTransform).Children[1];
         end = new System.Windows.Point(tt.X, tt.Y);
     }
 }
 private void ImagePreview_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     start = Mouse.GetPosition(ImagePreviewCanvas);
     if (e.ChangedButton == MouseButton.Middle)
     {
         ImagePreviewCanvas.CaptureMouse();
         // resets when children are hittble? idk
         var tt = (TranslateTransform)((TransformGroup)ImagePreview.RenderTransform).Children[1];
         origin = end;
         tt.X   = origin.X;
         tt.Y   = origin.Y;
         ImagePreviewCanvas.SetCurrentValue(CursorProperty, Cursors.ScrollAll);
     }
 }