0

I'm writing a WPF application, and I've come to a point where I need to get the UI Element that the mouse cursor is over at the time of a keypress. Basically, we have lists on the screen, and if the user enters Ctrl+Shift+F, they will be able to filter the objects just in the list that their mouse is over. I've done some research on this, and the only related questions I've found have to do with moving the cursor to a certain element on a keypress, not finding the element that the cursor is already over. I don't have any code to show for this since it is more of a conceptual question, but if you need any more detail from me, please let me know. Thanks!

Sean Cogan
  • 2,516
  • 2
  • 27
  • 42
  • 1
    I think you get your answer here:- VisualTreeHelper.HitTest http://stackoverflow.com/questions/45813/wpf-get-elements-under-mouse – Nayan Aug 12 '13 at 19:12

1 Answers1

1
var elementundermouse = Mouse.DirectlyOver as FrameworkElement;
Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154