本文介绍了应用程序主窗口是空的WPF(使用微卡利)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我开发一个WPF应用程序,我需要拿到一分,以控制内部的应用程序的主窗口。我使用的卡利微。 Application.Current.MainWindow 是空 我怎样才能到主窗口 应用>参考解决方案 这很有趣,我只是回答了这个在另一篇文章...尝试设置 Application.Current.MainWindow 在加载事件在 MainWindow.xaml.cs 文件属性: 私人无效MainWindow_Loaded(对象发件人,RoutedEventArgs E) { Application.Current.MainWindow =这一点; } I am developing a WPF application and I need to get a point to the main window of application inside a control. I am using Caliburn Micro. Application.Current.MainWindow is nullHow can I get a reference to the MainWindow of application in Caliburn Micro? 解决方案 That's funny, I've just answered this in another post... Try setting the Application.Current.MainWindow property in the Loaded event in the MainWindow.xaml.cs file:private void MainWindow_Loaded(object sender, RoutedEventArgs e){ Application.Current.MainWindow = this;} 这篇关于应用程序主窗口是空的WPF(使用微卡利)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 09:53