RoutedEventArgs.OriginalSource 屬性

定義

在父類別進行任何可能的 Source 調整之前,取得純點擊測試所判定的原始報告來源。Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

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

屬性值

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.

適用於

另請參閱