WPF DataGrid-由于拖放而无法使用鼠标滚动 [英] WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop
问题描述
我正在使用允许拖动其行的数据网格。我的问题是,当我尝试使用侧面滚动条上的鼠标在网格上向下滚动时,出现禁止进入标志,这意味着在这里不允许拖放,伙计...。我如何修改拖放功能以识别这不是拖放动作,而是滚动鼠标动作?
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);
}
}
}
推荐答案
没有一个答案...
我想我在这里做错了什么事...
I guess im doing something really wrong here...
无论如何,我刚刚切换为使用Telerik拖放功能,却忘了这个问题...
Anyhow, i just switched to use Telerik drag and drop functionality and forgot from this problem...
这篇关于WPF DataGrid-由于拖放而无法使用鼠标滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!