Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF window from a Console project?

Tags:

c#

console

wpf

I recently started a C# project (VS 2008) as a 'Console' project where I wrote a few libraries, test programs, etc. Now I'd like to add a couple of WPF windows, but it looks like console project won't let me do that. I'm coming from Java so this is a little strange. How can I add a WPF form (which I will instantiate my self from my "main" class?

like image 454
Shahbaz Avatar asked Dec 20 '25 16:12

Shahbaz


1 Answers

The accepted answer is not entirely true, I'm afraid, just add the [STAThread] attribute before your mainmethod and make references to the right libraries (like System.Windows) and you're all set to add wpf windows.

EDIT : in the comments @JamesWilkins supplied me with this usefull link : http://code-phix.blogspot.be/2013/11/creating-wpf-project-from-scratch.html

like image 177
Peter Avatar answered Dec 22 '25 11:12

Peter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!