When is the Window.SourceInitialized event raised

ぃ、小莉子 提交于 2019-12-10 22:54:40

问题


Can I guarantee the Window.SourceInitialized event will always be raised before the Window.Loaded event? I need the HwndSource object for further processing in my Window.Loaded event handler and I'm not sure if this will always be available by then


回答1:


Here's the sequence of events you can expect (it should occur before Loaded):

  • http://wpf.2000things.com/2012/07/30/613-window-event-sequence/

If you want to double-check, or don't trust getting the SourceInitialized event...then you can try and obtain the HwndSource yourself....to see if it's connected.

  • http://blogs.msdn.com/b/digitalnetbizz/archive/2007/03/09/presentationsource.aspx


来源:https://stackoverflow.com/questions/12077707/when-is-the-window-sourceinitialized-event-raised

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!