如何以编程方式从控制台启动WPF窗口?

时间:2022-12-30 20:44:02

I have a WPF window, I want to know if I can start it from a console programmatically?

我有一个WPF窗口,我想知道我是否可以通过编程方式从控制台启动它?

2 个解决方案

#1


19  

Hi You can use Application Class, with the help of this class,we can start wpf window programmatically,

您好您可以使用Application Class,在这个类的帮助下,我们可以通过编程方式启动wpf窗口,

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

#2


7  

Use the Application class:

使用Application类:

new Application().Run(new SomeWindow());

#1


19  

Hi You can use Application Class, with the help of this class,we can start wpf window programmatically,

您好您可以使用Application Class,在这个类的帮助下,我们可以通过编程方式启动wpf窗口,

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

#2


7  

Use the Application class:

使用Application类:

new Application().Run(new SomeWindow());