views:

1192

answers:

1

hey all,

I'm writing a WPF app whereby usercontrols are being dynamically created programmatically in response to an event. The main window canvas has a grid, and i'm adding new columndefs and rowdefs, which contain the new user controls.

I need these user controls to keep track of where the mouse is, so that they can respond to events depending on where the mouse is in relation to the UC's boundaries. This works fine within the bounds of the UC, but as soon as the mouse leaves the UC area (into another UC's area, or the parent window's area), the UC loses track of where the mouse is and can no longer respond.

Any suggestions as to how i can allow my UCs to keep track of the mouse's whereabouts? Perhaps from the parent window?

Thanks heaps greg

+2  A: 

You want to look into Mouse.Capture. Though, make sure you keep the CaptureMode in mind.

Todd White
Yeah I know about Mouse.Capture, but unfortunately I can't use this function. I was hopin for something on the window or usercontrol class that could communicate the details to the usercontrol... I think i may be barking up the wrong tree... :|
Gregorius