private static void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_startPosition == null || e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }

            var adapter = GetSelectorAdapter(sender as Selector);

            if (!isDragDistanceFulfilled(e.GetPosition(adapter.Selector)))
            {
                return;
            }

            // pick up data and start dragging
            var data = new Data
            {
                SenderDataContext = adapter.Selector.DataContext,
                SelectedItems     = new ArrayList(adapter.GetSelectedItems()), // must be a copy
                TargetIndex       = -1
            };

            _dropData = new DataObject(data);

            _startPosition = null;

            _senderAdapter = adapter;

            adapter.OnDragStarted();
            DragDrop.DoDragDrop(adapter.Selector, _dropData, DragDropEffects.Copy | DragDropEffects.Move);

            e.Handled = true;
        }
 private static double getDragScrollOffset(ASelectorAdapter adapter)
 {
     if (adapter.Selector is DataGrid)
     {
         return(DRAG_SCROLL_OFFSET_DATAGRID);
     }
     else if (adapter.Selector is ListBox)
     {
         return(DRAG_SCROLL_OFFSET_LISTBOX);
     }
     return(1);
 }
 private static void SetSelectorAdapter(Selector d, ASelectorAdapter value)
 {
     d.SetValue(SelectorAdapterProperty, value);
 }