void OnGridPreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (!IsLogicBlocked)
            {
                if (!StartSelectionInfo.IsLeftMouseButtonPressed || StartSelectionInfo.IsEmptyInfo())
                {
                    return;
                }
                if (!StartSelectionInfo.IsSelectionStarted)
                {
                    if (!Settings.IsDragging(StartSelectionInfo.MousePoint, e.GetPosition(DataArea)))
                    {
                        return;
                    }
                    Mouse.Capture(DataArea, CaptureMode.SubTree);
                    StartSelectionInfo.IsSelectionStarted = true;
                }

                UpdateCurrentSelectionInfo();

                UpdateVerticalScrolling(CurrentSelectionInfo.MousePoint);
                UpdateHorizontalScrolling(CurrentSelectionInfo.MousePoint);

                if (!ScrollController.IsScrollWorking)
                {
                    UpdateSelection();
                }

                ScrollController.UpdateVerticalScrollTimerInterval(DataArea.ActualHeight, e.GetPosition(DataArea).Y);
                ScrollController.UpdateHorizontalScrollTimerInterval(DataArea.ActualWidth, e.GetPosition(DataArea).X);
                e.Handled = true;
            }
        }
 public GridSelectingBehavior()
 {
     Settings                      = new SelectionBehaviorSettings();
     StartSelectionInfo            = new StartSelectionInfo();
     CurrentSelectionInfo          = new SelectionInfo();
     ScrollController              = new ScrollController(this);
     ScrollController.ScrollDown  += OnScrollControllerScrollDown;
     ScrollController.ScrollUp    += OnScrollControllerScrollUp;
     ScrollController.ScrollLeft  += OnScrollControllerScrollLeft;
     ScrollController.ScrollRight += OnScrollControllerScrollRight;
 }
 void OnGridPreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (!IsLogicBlocked)
     {
         StartSelectionInfo.Clear();
         TableViewHitInfo hitInfo = View.CalcHitInfo(e.OriginalSource as DependencyObject);
         if (!hitInfo.InRow && !hitInfo.InRowCell)
         {
             return;
         }
         StartSelectionInfo.MousePoint = e.GetPosition(DataArea);
         StartSelectionInfo.RowHandle  = hitInfo.RowHandle;
         StartSelectionInfo.Column     = hitInfo.Column;
     }
 }
 void OnGridPreviewMouseUp(object sender, MouseButtonEventArgs e)
 {
     if (!IsLogicBlocked)
     {
         if (!StartSelectionInfo.IsSelectionStarted)
         {
             return;
         }
         Mouse.Capture(null);
         ScrollController.StopHorizontalScrolling();
         ScrollController.StopVerticalScrolling();
         StartSelectionInfo.Clear();
         CurrentSelectionInfo.Clear();
         e.Handled = true;
     }
 }