View中的ScrollBar在启用DragDrop时失去Foc

View中的ScrollBar在启用DragDrop时失去Foc

本文介绍了ListView中的ScrollBar在启用DragDrop时失去Focus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个启用了DragDrop的ListView,里面有一些MouseHandlers和一个GridView:

I have a ListView with DragDrop enabled and some MouseHandlers and a GridView inside:

<ListView AllowDrop="True" 

          DragEnter="OnDragEnter" 

          Drop="OnDrop"

          ItemsSource="{Binding ...}" 

          SelectedItem="{Binding ...}" 

          PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown" 

          PreviewMouseRightButtonUp="OnPreviewMouseRightButtonUp" 

          PreviewMouseLeftButtonUp="OnPreviewMouseLeftButtonUp"

          PreviewMouseLeftButtonDown="OnPreviewMouseLeftButtonDown"

          MouseMove="OnMouseMove">
<ListView.View>
    <GridView>
...
    </GridView>
</ListView>



ListView的ScrollBar可见。

如果在列表视图中未选择任何项目,则everthing工作正常。

当一个项目被选中时,我会注意到这种行为:

我点击滚动条,当鼠标光标停留在栏内时,一切正常,但是当它离开时仍然按下鼠标按钮时滚动条,

滚动条失去焦点,执行鼠标移动处理程序中执行的拖放操作d。



我不知道为什么滚动条会失去焦点,有人有想法吗?


The ScrollBar of the ListView is visible.
When no item is selected in the listview, everthing works fine.
When an item is selected, i notice this behavior:
I click the scrollbar, when the mouse cursor stays inside the bar, everthing is ok, but when it leaves the bar while the mouse button is still pressed,
the scrollbar loses focus and the drag/drop operation which is implemented in MouseMove Handler is executed.

I do not know why the scrollbar loses focus, has anyone an idea?

推荐答案


这篇关于ListView中的ScrollBar在启用DragDrop时失去Focus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:34