0
votes

I have a control in silverlight and what I'd like it to know is if the mouse hovers over an entirely seperate control somewhere else on the xaml page.

Is this possible?

2

2 Answers

1
votes

In xaml for UserControl where your elements placed add trigger for MouseMoveHandler. Within this trigger do something like:

var position = e.GetPosition(null);
var elements = VisualTreeHelper.FindElementsInHostCoordinates(position, sender);
var Items = from element in elements
            where element is DesiredElement
            select element;

And do whatever you want with this item.
Hope, it will help you.

1
votes

If I understand what you need it can be done like this:

In your control create a method like

SubscribeToMouseEvents(FrameworkElement other)
{
 other.MouseEnter += MouseEnterHandler;
 other.MouseMove += MouseMoveHandler;
 other.MouseLeave += MouseLeaveHandler;
}

If this is not what you need please elaborate question more