English 中文(简体)
Switching to WPF. Is it time?
原标题:

I m considering switching from MFC to WPF.

My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration numbers?

My second concern is speed.

Any other considerations?

最佳回答

I ve been banging away at WPF for a while now. It is brilliant, but it still has (occasional) holes you ve to plug yourself. However all indications are .NET 4.0 will be a significant step forward.

I would say start now. The WPF learning curve is REALLY steep, and it ll be a while before you ll be releasing software to users, believe me. Also do yourself a favour and get the WPF Unleashed book. It s superior.

Speed isn t a consideration. The power WPF gives is well worth any drawbacks with speed, which - coming from Windows Forms - I haven t noticed to be honest.

问题回答

What kind of application are you developing? If it s a wide-distribution desktop app that you want your grandmother to install, your concern about .NET 3.0/3.5 adoption is valid. So far from what I ve seen, performance is less of a concern.

WPF penetration

First of all, Windows Vista and Windows 7 both have WPF preinstalled, which accounts for 35% of the market automatically. Windows XP has had it as it had .NET Framework 3.0 as an option in Windows Update for over three years, and many applications ship with it, so it is likely to also be installed on a high percentage of Windows XP machines. StatOwl indicates that about 80% of NET Framework installations are version 3 or above.

If you re shipping on CD it is no big deal to include the latest .NET Framework on the CD and have it install automatically. If users are downloading your application, it can contact Microsoft s web server to download and install the latest .NET Framework. Online ClickOnce deployment also has this capability if you want people to be able to start their application directly from the web browser without installing it.

So the bottom line is, you probably don t need to worry about whether people will have WPF installed on their machines or not unless your target market consists primarily of dial up customers on Windows XP who don t run much third-party software (i.e., they just run Windows and your application).

Speed

Not an issue. I have a 200 MHz Pentium Pro with 384 MB RAM from 1998 that I test my software on, and my WPF applications have comparable performance with equivalent MFC applications. If your WPF application uses lots of fancy graphics and animation it will run slowly on ancient CPUs and graphics cards, but so would an ordinary MFC application with the same features.

Don t even bother trying to use WPF if you are sticking with Visual Studio 2008 for the next year or two. The experience will be way too painful. I m talking about "my IDE crashed again" type of pain.

If you are going to use VS 2010 in the near future, then WPF is a blast. Download the beta, a couple of themes off CodePlex, are start playing. Once you get past the (freaking huge) learning curve I think you will find it to be quite enjoyable.

IMHO, you should wait for Visual Studio 2010 and WPF 4.0 to make the actual migration. They will close some very annoying gaps in the product.

Meanwhile, you can try it out. In terms of coding/readability -- it s going to be WAAAY better than with MFC =)

As for the performance and platform -- it shouldn t be a problem unless you have any very special circumstances (like if you can t require users to install .NET).

Also see this related question on switching to WPF from Windows Forms.

If you are thinking about a larger, modular, appliation I recommend checking out Prism. It s a bit of a beast itself, but you should be able to tackle it after coming to grips with C#, Dependency Properties and XAML. Plus, learning Prism gave me a much better understanding of WPF/Silverlight, at least from the development/binding side.

Mike Taulty posted an excellent 10 part video series on Prism. It s a great way to get your head around the platform.

I d also recommend the pages linked to from the Getting Started page on codeplex. After all that, you re probably ready to tackle the Reference Implementation which comes with the download.

A previous answer of mine might also help clear up any remaining confusion around Controllers/Presenters in the framework that you might have (I did).





相关问题
Copy data from Access to SQL

I am in the process of migrating an existing Access database to a SQL database with a web front-end. I have successfully copied the database to SQL using the SQL Server Migration tool and am working ...

MongoMapper and migrations

I m building a Rails application using MongoDB as the back-end and MongoMapper as the ORM tool. Suppose in version 1, I define the following model: class SomeModel include MongoMapper::Document ...

Switching to WPF. Is it time?

I m considering switching from MFC to WPF. My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration ...

rake db:migrate running all migrations correctly

I m fairly new to Ruby on Rails here. I have 2 migrate files that were provided. The first one, prefixed with 001, creates a table and some columns for that table. The next migrate file, prefixed ...

Migrate Java Applet to what/where?

I am reviewing currently a medium size code base (around 30K LOC) which uses a huge Applet and interfaces with other systems. It s a tool to create custom labels, so we need drag-n-drop and other ...

热门标签