RoutedEventArgs.OriginalSource 属性


在父类进行任何可能的 Source 调整之前,获取由纯命中测试确定的原始报告源。Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

 property System::Object ^ OriginalSource { System::Object ^ get(); };
public object OriginalSource { get; }
member this.OriginalSource : obj
Public ReadOnly Property OriginalSource As Object



在类处理可能对展平复合元素树进行任何 Source 调整之前的原始报告源。The original reporting source, before any possible Source adjustment made by class handling, which may have been done to flatten composited element trees.


此属性将在调用类事件处理程序或任何实例处理程序之前获取其值一次,在此之后永远不会进行调整。This property acquires its value once, before the class event handlers or any instance handlers are invoked, and is never adjusted past this point. 原始源信息对类处理程序或类实现是只读的,与事件数据中报告的信息相同。The original source information is read-only to class handlers or class implementations, just as it is reported in the event data.

源可以调整的常见情况是控件的内容模型中的内容元素 (列表项的内容,例如,将列表项元素报告为, Source 列表项中的实际元素将为 OriginalSourceCommon cases where the source may be adjusted include content elements inside a content model for a control (the contents of a list item, for instance, will report the list item element as the Source and the actual element within the list item will be the OriginalSource.

各种元素和内容模型的源调整因类而异。Source adjustment by various elements and content models varies from class to class. 每个调整事件源的类都尝试预见哪个源最适用于大多数输入方案和类所需的方案,然后将该源设置为 SourceEach class that adjusts event sources attempts to anticipate which source is the most useful to report for most input scenarios and the scenarios for which the class is intended, and then sets that source as the Source. 如果此源不是与事件处理相关的源,请 OriginalSource 改为查看它是否报告更适合的其他源。If this source is not the one that has relevance to your handling of the event, try checking OriginalSource instead to see if it reports a different source that is more suitable. 有关输入事件的更多详细信息,请参阅 输入概述For more details on input events, see Input Overview.