i have a main control in wpf. and many controls placed in main control. when mouse moves over main control i want to find over which control in main control mouse is placed.
+2
A:
i would do it using a view model. bind the model's property to the mouse over event and you will automatically have this property changed when the event occurs.
akonsu
2010-10-07 12:07:04
Converting event to command using EventBehaviour.
bjoshi
2010-10-07 16:14:41
A:
Sounds like you want UIElement.InputHitTest
. It takes in a 2D Point
(relative to the UIElement's location) and returns an IInputElement
which UIElement
implements. So for example...
Button button = myWindow.InputHitTest(mousePosition) as Button;
if (button != null)
// Blahblahblah
YotaXP
2010-10-07 16:44:43