I have a WPF
window, I want to know if I can start it from a console programmatically?
Asked
Active
Viewed 1.1k times
16

Mansuro
- 4,558
- 4
- 36
- 76

user496949
- 83,087
- 147
- 309
- 426
2 Answers
22
Hi You can use Application Class, with the help of this class,we can start wpf window programmatically,
Application app = new Application ();
app.Run(new Window1());

Dan Smith
- 280
- 3
- 13

Sankar Ganesh PMP
- 11,927
- 11
- 57
- 90
-
8Note: be sure to add `[STAThread]` attribute to the `Main` method. – IAbstract Oct 07 '15 at 16:32
-
won't work without the comment above. you will still get the "STA" error message. – interesting-name-here Apr 02 '18 at 13:34