I have a wpf project which uses transparent windows and I share this transparent window styling for my dialog windows and my mainwindow
.
I am getting an error on my DragMove()
event of my MainWindow
AFTER I close a dialog window that uses the same window style. To make this even more strange this exception only occurs when I handle a mouseleftbutton
event on a label in my Status Bar
on the MainWindow
. IF I swap out the label for a button and replace the mouseleftbuttondown
with a click
event I do not get the error.
The strange thing is that the dialog window that pops up does not implement dragmove
, and I'm not dragging around my mainwindow
either. Somehow dragmove
gets called after my code execution returns to the mainwindow
after a showdialog()
call.
An easy fix for me currently is to swap my label for a button and wire up the click event instead.
However, I'm more interested in hearing about what causes this issue and why a click event works but the mouse one fails miserably.
My "StatusBar" is simply a stackpanel
with labels and other stackpanels (which contain more labels).
Has anyone else fought this issue before? Would I need to implement some sort of mouseclick
event handler override so that I can capture and cancel this exception from happening?
Repro code can be provided if needed. I got enough hits on dragmove
here so I am hoping this is an easy one for somebody out there.
Thanks in advance for any help!
my brain isn't working properly today. I forgot about routing of events in this scenario. I simply needed to set the Handled property on my routedevent that fired off when the mousebutton was down. Somehow I missed that in the debugger before posting the thread.