Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open WPF window from Console Application [duplicate]

Tags:

c#

wpf

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 :).

like image 318
user2871989 Avatar asked Oct 11 '13 17:10

user2871989


People also ask

How do I open a new window in WPF?

You will need to create an instance of a new window like so. var window2 = new Window2(); Once you have the instance you can use the Show() or ShowDialog() method depending on what you want to do. var result = window2.

How do I display a WPF window?

When a Window is created at run-time using the Window object, it is not visible by default. To make it visible, we can use Show or ShowDialog method. Show method of Window class is responsible for displaying a window.

What is window in XAML?

It is the root window of an XAML application which provides minimize/maximize option, Title bar, border, and close button. It also provides the ability to create, configure, show, and manage the lifetime of windows and dialog boxes.


1 Answers

Application app = new Application();
app.Run(new Window1());
like image 99
Daniel Avatar answered Oct 21 '22 18:10

Daniel