(X) Hide this
    • Login
    • Join
      • Say No Bots Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Tip: How to get reference to the object that raised a routed event?

(0 votes)
Denislav Savkov
>
Denislav Savkov
Joined Feb 11, 2008
Articles:   14
Comments:   6
More Articles
0 comments   /   posted on Sep 17, 2008
Categories:   General

The callback function of a routed event has the second parameter e of type RoutedEventArgs or its inheritor. The Source property of this parameter holds reference to the object that raised the event. In contrast to that the sender parameter holds reference to the object where the event handler was invoked.

C#

void RoutedEventRaised( object sender, RoutedEventArgs e )
{
    object source = e.Source;
}

That's it!


Subscribe

Comments

No comments

Add Comment

Login to comment:
  *      *       
Login with Facebook