WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop
Posted
by
OrPaz
on Stack Overflow
See other posts from Stack Overflow
or by OrPaz
Published on 2010-11-08T14:47:19Z
Indexed on
2010/12/28
11:54 UTC
Read the original article
Hit count: 511
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);
}
}
}
© Stack Overflow or respective owner