Always_Confused
May 27th, 2009, 11:09 PM
OK so it seems the last few days I have seen more and more talk about WPF.
What exaclty is it (I know it means Windows Presentation Foundation)? Do I have it? Am I already using it? I have VS2008 3.5sp1 and I only work on Windows Applications at this time, no web, asp or C.
I have actually seen many articles but never got the clear picture.
It would be nice to see an expert put up an FAQ on this.
jmcilhinney
May 27th, 2009, 11:14 PM
Maybe the WPF forum would be the place to post questions on WPF. I've asked the mods to move this. Please don't double post.
WPF is part of the .NET Framework from version 3.0. WPF applications can be built with VS 2008 or later, VB Express 2008 or later or Expression Blend. We won't count the extensions to VS 2005 as they didn't get past beta for WPF.
http://msdn.microsoft.com/en-us/library/ms754130.aspx
chris128
May 28th, 2009, 04:03 AM
Well im certainly not an expert, but I use WPF for all of my new projects so here's my description of it:
WPF is kind of like the next generation of winforms, only its not a true 'upgrade' from winforms because WPF has been built from scratch and as such is still lacking some features that winforms has had for years. As you may have gathered from the name, Windows Presentation Foundation, this platform is all about presentation. What I mean by that is, it centres a lot more on the visual aspects of a program than winforms does - one example of this is the fact that all controls in WPF are vector based, which means you can resize them in any way you want and they will always look clear and crisp. Whilst this doesnt sound like that much of a benefit, once you get using it you realise that this makes some things possible that you couldnt really do in winforms. A good example of this is animations, although you can animate things in winforms it never really looks that good does it and its always kind of a hack to make it work. WPF supports animations completely and even has its own Animation namespace where you can find animation classes such as Storyboard and DoubleAnimation. So if you want a progress bar to stretch, spin around, shrink and then fade away...you can do that with ease (although you wouldnt really want to, but thats just an example :) )
Whilst WPF does focus on the visual aspects, it still provides plenty of functionality for working with data etc and pretty much all of the normal .NET framework classes are there for you to use just as you would in winforms. There are some slight differences but these mainly relate to components and controls, not the data processing type of classes.
Another thing to note is that the user interface is actually developed using XAML code, so whilst you can still drag and drop controls from the toolbox onto your forms (now named Windows, not Forms) you can also edit any part of your interface using the XAML text editor in VS. I actually do most of my editing via XAML now to be honest, as the VS designer seems to mess a lot of things up when you drag n drop controls from the toolbox. Its not hard at all though, lets say I wanted a button on my window, all I would have to type in the XAML window would be:
<Button Name="Button1" Content="Click Me!" />
Oh and the controls are all completely customisable, you can replace any of the standard control templates and styles with your own. So if you want your buttons to have rounded corners, or have a black gloss effect, go for it its completely supported by WPF and with Expression Blend doesnt take long to do at all.
As for how you can go about getting started with WPF - if you have VS 2008 like you say then simply go to start a new project, make sure the target framework box in the corner is set to 3.5, select the Windows category and then you should see "WPF Application" as one of the possible project types.
I will warn you now though, it does take quite a bit of getting used to at first if you have been using Winforms for a while. A lot of the common property names are slightly different in WPF - for example a Button no longer has an "Enabled" property, it has an "IsEnabled" property. You will probably hate it for the first few weeks if you do try and use it, but after that initial struggle, if your anything like me, you will never want to go back to winforms :)
Here's an example of an app made using WPF: http://community.devexpress.com/blogs/thinking/DXGrid%20for%20WPF.png
and another:
http://www.istartedsomething.com/wp-content/uploads/2008/01/lawson_1l.jpg
DeanMc
May 28th, 2009, 05:06 AM
The more I think about it the more I feel that WPF was never meant to take over from winforms but rather reach out and grab the people who where in between shrink wrap and custom software. These people tended to have pretty programs not just functional ones so providing these people with a design focused framework was the best way of getting them on board.
I also think that Microsoft is trying to start a revolution of sorts in the LOB type applications The fact is that most LOB applications are fugly as hell. This may not be a relevant reason to scrap winforms but it is one Microsoft seem to slowly be getting behind.
I don't think WPF will hit critical mass until way after 4.0 and 2010 is released as the current tools are too limiting to be widely accepted by the people who hold the purse strings.
r0k3t
Jun 4th, 2009, 10:48 AM
Uhm, what is meant by LOB?
Thanks...
DeanMc
Jun 4th, 2009, 11:50 AM
see here :wave:
http://www.cryer.co.uk/glossary/l/lob.htm