Beispiel #1
0
 /// <summary>
 /// 释放拖拽
 /// </summary>
 void ReleaseCapture()
 {
     ReleasePointerCaptures();
     _pointerID = null;
     _state     = MouseVisualState.Normal;
     ChangeVisualState();
 }
Beispiel #2
0
 /// <summary>
 /// 鼠标离开
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPointerExited(PointerRoutedEventArgs e)
 {
     base.OnPointerExited(e);
     if (Owner != null && _pointerID == null)
     {
         _state = MouseVisualState.Normal;
         ChangeVisualState();
     }
 }
Beispiel #3
0
 /// <summary>
 /// 鼠标进入状态
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPointerEntered(PointerRoutedEventArgs e)
 {
     base.OnPointerEntered(e);
     if (Owner != null && !IsSelected && _pointerID == null)
     {
         _state = MouseVisualState.Enter;
         ChangeVisualState();
     }
 }
Beispiel #4
0
        /// <summary>
        /// 鼠标按下
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            base.OnPointerPressed(e);
            if (Owner != null && CapturePointer(e.Pointer))
            {
                e.Handled  = true;
                _pointerID = e.Pointer.PointerId;
                _state     = MouseVisualState.Pressed;
                Focus(FocusState.Programmatic);

                if (!IsSelected)
                {
                    IsSelected = true;
                }
                else if (Owner.AllowSwapItem)
                {
                    ChangeVisualState();
                }
            }
        }