开发者

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

开发者 https://www.devze.com 2023-01-14 04:47 出处:网络
As you can see here, I can\'t use reflection to get the multicast delegates of the private开发者_JAVA技巧 fields behind these FrameworkElement events because they aren\'t field-like. So how to do it?P

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


Please try this:

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

It should work! :)

0

精彩评论

暂无评论...
验证码 换一张
取 消