Source. Add Source Changed Handler(IInputElement, SourceChangedEventHandler) Method
Adds a handler for the
SourceChanged event to the provided element.
public: static void AddSourceChangedHandler(System::Windows::IInputElement ^ element, System::Windows::SourceChangedEventHandler ^ handler);
[System.Security.SecurityCritical] public static void AddSourceChangedHandler (System.Windows.IInputElement element, System.Windows.SourceChangedEventHandler handler);
static member AddSourceChangedHandler : System.Windows.IInputElement * System.Windows.SourceChangedEventHandler -> unit
Public Shared Sub AddSourceChangedHandler (element As IInputElement, handler As SourceChangedEventHandler)
The element to add the handler to.
The handler implementation to add.
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.
-=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.