I have a WPF app that has a ListBox
. The drag mechanism is already implemented, but when the list is too long and I want to move an item to a position not visible I can't.
For example, the screen shows 10 items. And I have 20 items. If I want to drag the last item to the first position I must drag to the top and drop. Scroll up and drag again.
How can I make the ListBox
auto scroll?
Got it. Used the event
DragOver
of theListBox
, used the function found here to get thescrollviewer
of the listbox and after that its just a bit of juggling with the Position.Based on this I have created an Attached Behavior which can easily be used like this -
Here is the code for attached behavior -