/// <summary>
        /// Invoked when an unhandled MouseUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.Windows.Input.MouseButtonEventArgs" /> that contains the event data. The event data reports that the mouse button was released.</param>
        protected override void OnPointerReleased(PointerReleasedEventArgs e)
        {
            base.OnPointerReleased(e);
            if (e.Handled)
            {
                return;
            }

            e.Pointer.Capture(null);

            if (e.Pointer.Type == PointerType.Touch)
            {
                var position = e.GetPosition(this).ToScreenPoint();

                var touchEventArgs = new OxyTouchEventArgs()
                {
                    ModifierKeys     = e.KeyModifiers.ToModifierKeys(),
                    Position         = position,
                    DeltaTranslation = new ScreenVector(0, 0),
                    DeltaScale       = new ScreenVector(1, 1),
                };

                TouchPositions.Remove(e.Pointer.Id);

                if (TouchPositions.Count == 0)
                {
                    e.Handled = ActualController.HandleTouchCompleted(this, touchEventArgs);
                }
            }
            else
            {
                e.Handled = ActualController.HandleMouseUp(this, e.ToMouseReleasedEventArgs(this));

                // Open the context menu
                var p = e.GetPosition(this).ToScreenPoint();
                var d = p.DistanceTo(mouseDownPoint);

                if (ContextMenu != null)
                {
                    if (Math.Abs(d) < 1e-8 && e.InitialPressMouseButton == MouseButton.Right)
                    {
                        ContextMenu.DataContext = DataContext;
                        ContextMenu.IsVisible   = true;
                    }
                    else
                    {
                        ContextMenu.IsVisible = false;
                    }
                }
            }
        }