WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop
- by OrPaz
Hello,
I am using a datagrid that is allowing to drag its rows. My problem is that when i try to scroll down on my grid using the mouse on the side scroller, i get the 'no enterance' sign that means that "drag and drop is not allowed here, dude...". How can i modify my drag and drop function to recognize that this is not a drag and drop action, but a scroll mouse action?
private new void MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
Point currentPosition = e.GetPosition(GridUC);
Object selectedItem = GridUC.SelectedItem;
if (selectedItem == null) return;
DragDropContainerObject ddObject = new DragDropContainerObject(typeof(Actor), selectedItem);
DataGridRow container = (DataGridRow)GridUC.ItemContainerGenerator.ContainerFromItem(selectedItem);
if (container != null)
{
DragDropEffects finalDropEffect = DragDrop.DoDragDrop(container, ddObject, DragDropEffects.Link);
}
}
}