gamedevv
gamedevv

Reputation: 315

WPF without Visual Studio?

Would it be practical to create WPF applications without ever touching Visual Studio (or any other IDEs)? As in, coding and compiling completely within Vim and the command-line? What resources would you recommend for someone trying to do so?

Upvotes: 8

Views: 14722

Answers (6)

user12149069
user12149069

Reputation:

The newest version (3.0) now supports the wpf template.

Just download it from: https://dotnet.microsoft.com/

Just type in console:

dotnet new wpf -o wpfHello

cd wpfHello

code .

Greetings :-)

Upvotes: 1

marc_s
marc_s

Reputation: 754220

It would be possible, since basically WPF is based on XAML - a variant of XML - and C# or VB.NET or another .NET language as its backend language.

The question really is whether that's practical and if it makes sense - I highly doubt it. WPF is all about visual design, e.g. totally without a visual designer (either the built-in one in Visual Studio, preferably the 2010 version; or some other visual designer), it seems a bit silly to want to program WPF....

As for resources - well, a least a text editor is a must, then definitely a few good books on WPF, and you could leverage the C# or VB.NET compiler that comes with the .NET framework.

Upvotes: 9

dustyburwell
dustyburwell

Reputation: 5813

It's definitely possible. I'd say it's not practical, though.

To be honest, I do professional WPF development and I do it with the visual designer closed. I'm much more comfortable editing the XAML by hand, just like I write HTML. However, the benefits of an IDE go far beyond the visual designer. There's IntelliSense, debugging and a whole host of other invaluable features.

Really, I must question your motives. What are you trying to gain? Visual Studio Express editions fully support WPF development, so it can't, or shouldn't, be a cost issue.

Upvotes: 2

Ray Burns
Ray Burns

Reputation: 62909

I have found myself writing XAML in Notepad on a number of occasions where I needed to create a quick UI but couldn't load an IDE. It is really quite trivial, and almost - but not quite - as fast as using an IDE. The main advantages of an IDE such as Blend or VS.NET are in quickly getting things like colors and animations to be "just right."

Another occasion when I frequently write XAML or C# in a text editor is here on Stack Overflow. I only fire up Visual Studio when I need to test something out.

My main recommendations for creating WPF applications without an IDE are:

First you should make proper use of WPF's layout system, using appropriate panels and "Auto" sizing wherever possible. For example, if you want a stack of buttons with some space between them, create a <StackPanel>, and on each button add Margin="4" or whatever. This is good design anyway. Most beginning WPF programmers treat it like WinForms with no layout capability, which is a shame. WPF has a very powerful layout engine and it should be used. If it is, there will never be any need for graph paper or measurements. In addition, your UI will automatically adjust its layout if you change font sizes or objects are larger than expected.

Second you should use msbuild for your project unless it is ultra-simple. msbuild is installed along with NET Framework so it is always available. The file format is very easy to edit with a text editor, and it is much better than a batch file with the appropriate "csc" command because it allows you to use code-behind and is less error-prone when adding new source files.

Third keep a PowerShell command line window open separate from your editor, with a command that runs "msbuild" and then executes your application. To run your app, then just Alt-Tab to this window and hit uparrow, Enter. Some text editors have the ability to execute user-defined commands directly from within the editor and see the output, in which case this second window is not necessary.

Fourth keep a copy of cordbg or mdbg handy. Although an IDE is the ideal place to do your debugging, any debugger is better than none at all. You will find your problems much faster if you stop at breakpoints and examine variables than if you just keep editing code and re-running.

Fifth, use "ColorPad" or a similar application to select your colors for use. Just guessing and entering your best guess in hexadecimal just doesn't work very well.

For resources, I recommend you get the book "WPF Unleashed" and work through the examples. I would also read a lot of other people's XAML, such as can be found on CodePlex.

Upvotes: 9

ChrisF
ChrisF

Reputation: 137108

If you really want to go down this route, I'd recommend getting some graph (squared) paper and a sharp pencil.

Draw out your designs on that, read off the positions and type them into your editor of choice.

One benefit of this is that you're going to have a paper prototype to show people ;)

As James Keesey points out in his comment on marc_s's answer, your edit-compile-test cycle is going to be painful.

Upvotes: 3

DenaliHardtail
DenaliHardtail

Reputation: 28296

Possible, Yes. Practical No.

For production work, I would consider Microsoft Expression Blend 3. Then copy the XAML and paste it into the editor of your choice and compile from the command line.

You could download KAXAML . It's a free, lightweight editor. I found it good for learning about XAML and seeing how minor changes and tweaks can impact on an overall design.

XAML is plain old text so find a free editor (KAXAML), use it, and if you must, paste into your editor.

Upvotes: 5

Related Questions