Adds a handler for the SourceChanged event to the provided element.
Assembly: PresentationCore (in PresentationCore.dll)
[UIPermissionAttribute(SecurityAction.LinkDemand, Window = UIPermissionWindow.AllWindows)] public static void AddSourceChangedHandler( IInputElement element, SourceChangedEventHandler handler )
Despite what the syntax block for this event states, there is no legitimate Extensible Application Markup Language (XAML) attached property usage. You should not attempt to add handlers in Extensible Application Markup Language (XAML), and handlers in code should only be placed on objects that serve as hosts for presentation (PresentationSource ) content. Such handlers should only be attached during object initialization, and should be explicitly removed in a Dispose method or equivalent object cleanup.
Even though this is a routed event, there are special restrictions placed on this event that differ from normal routed event behavior, due to the relatively small number of elements in a typical application scenario that would concern themselves with handling this event.
The C# += and -= event handler syntaxes, and related language specific handler syntaxes, are not supported, because the event itself is not exposed as public. Only the PresentationSource utility methods for adding and removing the handlers directly are supported.
Class handlers are not allowed. Specifically, you cannot call RegisterClassHandler against this event in a class constructor because although an identifier field exists for SourceChanged, the identifier is not public.
All registered handlers will receive the SourceChanged event even if one of the handlers attempts to mark the arguments as handled.