WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop

孤者浪人 提交于 2019-12-13 18:03:29

问题


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);
            }
        }

    }

回答1:


Not a single answer...

I guess im doing something really wrong here...

Anyhow, i just switched to use Telerik drag and drop functionality and forgot from this problem...



来源:https://stackoverflow.com/questions/4124877/wpf-datagrid-cant-use-mouse-to-scroll-because-of-drag-drop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!