private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     ((FrameworkElement)sender).ReleaseMouseCapture();
     resetColors();
     currentResizingMode = resizingMode.none;
 }
 private void Rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     ((FrameworkElement)sender).CaptureMouse();
     currentResizingMode = (resizingMode)Enum.Parse(((Type)typeof(resizingMode)), ((FrameworkElement)sender).Tag.ToString(), true);
     setColor((Rectangle)sender);
     origin = new Point(e.StylusDevice.GetStylusPoints((UIElement)this.Parent)[0].X,
             e.StylusDevice.GetStylusPoints((UIElement)this.Parent)[0].Y);
 }