Background: I am implementing Drag & Drop from TreeView. The requirement is that dragging an element should not change the selection - only a full click (MouseUp on the same element) should select that element.
However, the default behavior of TreeView is to raise the SelectedItemChanged event in MouseDown. Any idea on how to change this?
Thanks!
EDIT: I forgot to mention an important point - my apologies. I use the Gong drag & drop framework for all drag and drop operations, as it works very well with MVVM (no code is needed in my Views). The drag & drop logic is fully processed in ViewModels through attached properties in XAML Views.
Therefore, solutions that include PreviewMouseDown
and control the entire selection and drag and drop logic will be counterproductive. So I'm just looking for a (simple) way to prevent the TreeView control from changing the selection already on the mouse, but still pick up the usual bubble events like MouseDown
, MouseMove
, etc., For the drag and drop library to work as per project.
My next idea would be to change the Gong drag & drop drag-and-drop code itself - I was just hoping I could avoid it, and someone would come up with a simple way to change TreeView's behavior in this regard.
source share