private void Grid_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MouseIsDown = false;
            ImageGrid.ReleaseMouseCapture();

            ChangeSelectionRectangle(MouseDownPosition, e.GetPosition(ImageGrid));
        }
 private void ImageGrid_MouseUp(object sender, MouseButtonEventArgs e)
 {
     try
     {
         _mouseDown = false;
         ImageGrid.ReleaseMouseCapture();
         _mouseUpPosition = e.GetPosition(PreviewImage);
         ((CriteriaCreatorViewModel)DataContext).PreviewImageWidth  = PreviewImage.ActualWidth;
         ((CriteriaCreatorViewModel)DataContext).PreviewImageHeight = PreviewImage.ActualHeight;
         ((CriteriaCreatorViewModel)DataContext).InitialPosition    = _mouseDownPosition;
         ((CriteriaCreatorViewModel)DataContext).ReleasePosition    = _mouseUpPosition;
         ((CriteriaCreatorViewModel)DataContext).SelectionSize      = new System.Drawing.Size(Convert.ToInt32(CriteriaSelectionBox.Width), Convert.ToInt32(CriteriaSelectionBox.Height));
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message.Trim());
     }
 }