Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当 MainWindow 现在 SHOWN 和 VISIBLE 时,哪个事件在 MainWindow 中被触发?当我尝试在 Loaded 事件中显示对话框时,窗口仍不会完全加载/可见
您可以使用 IsVisibleChanged事件:
IsVisibleChanged
private void MainWindow_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool) e.NewValue == true) { //DO Stuff } }
我通过监听ContentRendered事件解决了我的问题。
ContentRendered