开发者

WPF Disable the item selection on MouseMove of a ListBox

If I press the mouse on an item of a ListBox and then move the mouse without releasing the mouse-button over another item, the selection automatically changes to the element that is under the mouse.

Is there a possibility to disable this behaviour, so that the selection is only changed when the m开发者_Go百科ouse has been pressed directly over the item (I need this for initiation Drag&Drop with multiple selected items, the default-behaviour has an ugly side-effect)?

Or alternatively, is there a good example for drag&drop that resolves all the obstacles that arise when implementing drag&drop for multiple items with a ListBox.


This is the default behavior of the listbox, and cannot be changed.

There are 2 tricks you should try: 1. Subscribe to preview mouse up and mark the handled to true. 2. Inherit items control and implement your own selector.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜