views:

123

answers:

1

I'm trying to implement drag and drop behaviour between a bunch of ListViews. I've found this solution that uses attached properties: http://www.beacosta.com/blog/?p=53

But whenever I try to perform a drag and drop, I get the following error message in the debug log:

A first chance exception of type 'System.IndexOutOfRangeException' occurred in my.exe

I've tracked it down and can see that it's thrown while DragDrop.DoDragDrop is running, but since the exception is just swallowed I have no idea where in the code it is being thrown from. How do I trap this exception to find this out?

A: 

The main problem I had with this was that I didn't know how to make Visual Studio break when an exception was thrown within the WPF code as I was doing the drag and drop operation. Turns out this can be done under the Debug-menu in Visual Studio:

Debug -> Exceptions -> Find the exception you're interested in and click the checkbox so that the debugger breaks when the exception is thrown also.