Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am dragging an Image from a Listbox into an ItemsControl which lies inside a ScrollViewer.

The DragDrop is my own Implementation and not the ordinar DragDrop class, allowing me to capture the scrollwheel while dragging.

However when i scroll i want the ItemsControl to scroll and not the ListBox.

I tryed capturing the MouseEventArgs and overide the "e.source" but i can't because of some exception meaning that the scrolling is already begun so you can't change the source.

Then i tried ItemsControl.Focus() before i scroll but no, it keeps scrolling the ListBox.

Any suggestions?
Posted

1 solution

Second time in a row i post a question and find the answer within an hour..

I used
VisualTreeHelper.GetChild(DependencyObject reference, int childIndex)
to find access the visual tree and get a reference to the scrollviewer which was inside an
<itemspaneltemplate></itemspaneltemplate>
.

Then using
LineUp()
or
LineDown()
had the job done.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900