How to retrieve the actual object that bubbles a routed event? RRS feed

  • Question

  • I'm wondering how to get a reference to the actual object that fires an event (such as LeftMouseButtonDown).  The object is a Grid contained within a control template for a custom UserControl, and I'm currently using the following code to handle the event:


    Code Block


    (RoutedEventHandler)delegate(object sender, RoutedEventArgs args)






    The problem with this is that the sender object is actually my UserControl instance, not the little GRID element that's contained within it. 


    Any clue as to what i'm doing wrong?



    Friday, October 26, 2007 9:14 PM