Assembly: PresentationCore (in presentationcore.dll)
protected virtual void InvokeEventHandler ( Delegate genericHandler, Object genericTarget )
protected function InvokeEventHandler ( genericHandler : Delegate, genericTarget : Object )
The generic handler / delegate implementation to be invoked.
The target on which the provided handler should be invoked.
The base implementation incorporates reflection to determine the right handler for any case where the handler is not literally RoutedEventHandler, and this reflection step does have some performance consequences. Invocations can be made more efficient by not relying on reflection. This is the scenario that motivates this method being available for any routed event arguments class that choose to override it. Implementations should not call the base for this method, because your implementation should already be responsible for invoking the type safe handlers.Notes to Inheritors: This method is intended to be overridden by derived event data classes to provide more efficient invocation of their delegates. The implementation should cast the provided genericHandler to the type-specific delegate, and then invoke that handler. The default implementation will attempt to invoke the provided handler, attempting to cast it as RoutedEventHandler. If either genericHandler or genericTarget is provided as a null reference (Nothing in Visual Basic), exceptions will be raised.
The following is pseudocode that illustrates a basic pattern that can be used for implementation. Here, MyRoutedEventHandler is a subclass of RoutedEventHandler.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.