Beispiel #1
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (!IsDragging && Interaction.AllowMouseLeftButtonDown(e))
            {
                e.Handled = true;

                CaptureMouse();
                IsDragging = true;

                Debug.Assert(this.Parent is UIElement);

                _origin = _previousPosition = e.GetPosition((UIElement)this.Parent);

                // Raise the DragStarted event
                bool success = false;
                try
                {
                    DragStartedEventHandler handler = DragStarted;
                    if (handler != null)
                    {
                        handler(this, new DragStartedEventArgs(_origin.X, _origin.Y));
                    }
                    success = true;
                }
                finally
                {
                    // Cancel the drag if the DragStarted handler failed
                    if (!success)
                    {
                        CancelDrag();
                    }
                    Interaction.OnMouseLeftButtonDownBase();
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Provides handling for the MouseLeftButtonDown event.
 /// </summary>
 /// <param name="e">The data for the event.</param>
 protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if (_interaction.AllowMouseLeftButtonDown(e))
     {
         _interaction.OnMouseLeftButtonDownBase();
         base.OnMouseLeftButtonDown(e);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Overriding the handler for the MouseLeftButtonDown event.
 /// </summary>
 /// <param name="e">MouseButtonEventArgs.</param>
 protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if (Interaction.AllowMouseLeftButtonDown(e))
     {
         Interaction.OnMouseLeftButtonDownBase();
         if (ClickMode != ClickMode.Hover)
         {
             StartTimer();
         }
     }
 }