如何从控制台应用程序打开 WPF 窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19324186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 09:50:08  来源:igfitidea点击:

How to open WPF window from Console Application

c#wpf

提问by user2871989

I have just made a simple Console Application and i would like to open WPF window now. I added WPF item to my Application :P. But i have no idea how to Open this window from my Main(). I hope some1 can help me :).

我刚刚制作了一个简单的控制台应用程序,现在我想打开 WPF 窗口。我在我的应用程序中添加了 WPF 项目:P。但我不知道如何从我的 Main() 打开这个窗口。我希望some1可以帮助我:)。

回答by Daniel

Application app = new Application();
app.Run(new Window1());