Export (0) Print
Expand All

RoutedEventArgs.OriginalSource Property

Gets a reference to the object that raised the event.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public Object OriginalSource { get; internal set; }

Property Value

Type: System.Object
The object that raised the event.

For any bubbling routed event that has actually traveled the route beyond the element that raised it, and for any tunneling routed event that has not yet tunneled down to the element that raised it, the value of OriginalSource will be different than the value of the sender parameter of the event handler signature. Which of the two elements involved in the event is of the most importance in any given handler (OriginalSource, the element that raised it, or sender, the element that is currently handling it) is dependent on the application logic that your handler is addressing. For example, control compositing is often interested in OriginalSource, whereas usage of existing control instances in applications is generally only interested in sender unless the application's UI structure also uses event routing and a deliberately nested composition structure to "forward" input events.

In WPF, there is a concept of a Source property that is separate from OriginalSource. This distinction is not present in Silverlight, because classes cannot adjust the reported source of a routed event in the Silverlight event system. (In WPF, control classes sometimes adjust the event source as part of their compositing logic.)

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2014 Microsoft