Compartir a través de


RoutedEventArgs.OriginalSource Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a reference to the object that raised the event.

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

Syntax

'Declaration
Public Property OriginalSource As Object
public Object OriginalSource { get; internal set; }

Property Value

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

Remarks

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.)

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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