private void InstalledAddonDataGrid_OnPreviewMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton != MouseButtonState.Pressed) { return; } var position = e.GetPosition(null); if (!(Math.Abs(position.X - _prevMousePoint.X) > SystemParameters.MinimumHorizontalDragDistance) && !(Math.Abs(position.Y - _prevMousePoint.Y) > SystemParameters.MinimumVerticalDragDistance)) { return; } _prevRowIndex = Grid.GetDataGridItemCurrentRowIndex(e.GetPosition); if (_prevRowIndex < 0) { return; } if (e.IsColumnSelected()) { return; } Grid.SelectedIndex = _prevRowIndex; var selectedAddon = Grid.Items[_prevRowIndex] as InstalledAddonDataGridItem; if (selectedAddon == null) { return; } const DragDropEffects dragDropEffects = DragDropEffects.Move; if (DragDrop.DoDragDrop(Grid, selectedAddon, dragDropEffects) != DragDropEffects.None) { Grid.SelectedItem = selectedAddon; } }