Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to raise Onload/OnUnload event from FrameworkElement for unit testing purposes?

As you can see here, I can't use reflection to get the multicast delegates of the private fields behind these FrameworkElement events because they aren't field-like. So how to do it?

like image 961
andrecarlucci Avatar asked Sep 01 '10 13:09

andrecarlucci


1 Answers

Please try this:

yourControl.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent));

It should work! :)

like image 65
Marcel de Castilho Avatar answered Oct 02 '22 10:10

Marcel de Castilho