Window.SourceInitialized事件何时引发 [英] When is the Window.SourceInitialized event raised

查看:211
本文介绍了Window.SourceInitialized事件何时引发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以保证在Window.Loaded事件之前总是引发Window.SourceInitialized事件吗? 我需要HwndSource对象在我的 Window.Loaded事件处理程序中进行进一步处理,但是我不确定到那时是否总是可用

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

推荐答案

以下是您可以预期的事件序列(应该在加载之前发生):

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

如果您要仔细检查,或者不信任获取SourceInitialized事件...那么您可以尝试自己获取HwndSource ...以查看其是否已连接.

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.

这篇关于Window.SourceInitialized事件何时引发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆