tags:

views:

24

answers:

2

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
Converting event to command using EventBehaviour.
bjoshi
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