Sunday, June 06, 2010

WPF – I’m Not Dead Yet!

UPDATE 6/5/2010: Added a couple more below on performance and windowing based on discussion with Silverlight/WPF insiders.

I’ve been hearing a lot of people talking about WPF lately as it if was a poor elderly relative that is terminally ill. “Yeah, poor Fred, he always showed so much promise, but never really amounted to anything. And now he is on his way out…”

I think this perspective on WPF is rubbish, especially for the next couple years at least. Images of Monty Python’s Bring Out Your Dead scene pop to mind, except WPF is vibrant and ready for a marathon, not laying in a cart.

Part of the problem is that as developers we tend to jump on the newest shiniest toy on the playground and forget there are others that are just if not more capable.

The main reason for people talking this way is Silverlight 4. First let me start by saying I love Silverlight 4. The improvements made in this release are fantastic, and do significantly close the gap in capabilities between WPF and Silverlight. And for an awful lot of business and consumer applications out there, Silverlight 4 is now good enough to build those apps using Silverlight instead of WPF. So I am not in any way trying to bash Silverlight, just point out that it is not the only shiny toy on the playground.

The gap in capabilities is still there in substantial ways for certain scenarios that you can’t easily write off by just saying you will build all your business desktop applications in Silverlight now. At some point, maybe a couple more releases of Silverlight away, there will be parity. In fact, by that point, I hope and think the technologies will merge and for a lot of what you do you will just be using the same set of libraries from the framework, and will choose from a range of deployment modes for your application and its host. If that is the case, it doesn’t matter what you call it, it doesn’t make WPF any less relevant today. We already have somewhere between 60-80% code equivalence in WPF and Silverlight 4 depending on whether you focus on the core UI and supporting code or the hosting code.

The main feature that people point to in SL4 that they try to say “See, we don’t need to bother with WPF now” is Out-Of-Browser (OOB) elevated trust. The first important point here is that it is “Elevated” not “Full”. You have the ability to do a lot of things you couldn’t do before based on that elevated trust, but there are still a lot of things you could be blocked from doing that would be no problem in a WPF application. Additionally, for almost all the new things in Silverlight 4, you can look at the corresponding capability in WPF and realize that Silveright is still the “challenged” sibling. Even though these new features cover the 80% for most apps, that remaining 20% might be just the thing you need, and not having it could either cost you a lot of time and money trying to compensate, or penalize your users because of the lack of capability.

Let me run through some of the key differences that make me hesitate to jump too quickly to Silverlight 4 when choosing a client application technology.

File access:

WPF – Unlimited

Silverlight – User profile special folders (My Documents, My Pictures, My Videos, etc.)

Printing:

WPF – Many options, access to Print Dialog, control print queues, etc

Silverlight – Print a UI element programmatically

Documents and editing:

WPF – Flow and fixed document, RichTextBox editing and integration with flow document

Silverlight – RichTextArea control with most functionality of the WPF RichTextBox

Commands:

WPF – Support for raising commands on buttons, hyperlinks, menu items; input bindings tied to commands for keyboard shortcuts; routed commands implementation in the box

Silverlight – Support for raising commands on buttons, hyperlinks, context menu items, no input bindings, no routed commands

Communications:

WPF – Full range of WCF capabilities, able to consume and host services of any kind, full range of security options and other WS-* protocols, REST, low level communications of many kinds

Silverlight – Limited subset of WCF client capabilities, no ability to expose a service from the client, unsecured TCP or HTTP protocols, duplex less capable than WPF clients (polling HTTP or unsecured TCP only), some socket level capabilities, have to take cross domain considerations into mind in most deployment scenarios.

Clipboard:

WPF – Any kind of serializable objects

Silverlight – Text only

Drag Drop:

WPF – Any kind of object

Silverlight – Files only

External devices:

WPF: Anything with a driver, COM, Win32, or communications protocol

Silverlight: Webcam, camera, microphone, and devices with a COM API or compatible communication protocol

Input:

WPF – Keyboard, mouse, pen, touch no real limitations

Silverlight – Must be OOB elevated trust full screen to have full keyboard access

Performance (anecdotal, but consistent with what I have seen):

WPF – Better hardware acceleration because it can fully leverage the DirectX platform

Silverlight – Hardware accelerated on Windows, but not as deeply as WPF

Windowing Control:

WPF – Party on. Open as many windows as you want, programmatically control size, position, etc. anytime

Silverlight OOB – limitations on when and where you can size/position windows, can’t have multiple open non-modal windows

The bottom line is that if your client application is mainly a front end for back end data – Silverlight 4 is perfect and sufficient. But if your client application needs deeper integration with the client machine and other things that reside client side, it may be possible to get it done with SL4 elevated trust OOB, but it will likely be more challenging and you may hit brick walls that kill your productivity or functionality. You really need to do a good up front requirements analysis and if you have any significant interaction with client machine resources, WPF is still going to make your life easier.

That being said, at the current time, WPF is the “Challenged” sibling in terms of a couple of newer technologies. The WCF RIA Services capabilities for generating client side code and having the DomainDataSource is very attractive for a broad range of business application use cases. That will be coming in a future release for WPF, but in the meantime, Silverlight has the leg up there. Additionally, MEF added some convenience classes in Silverlight 4 that didn’t make it back into the main .NET Framework that make certain composition scenarios a little easier and cleaner to code. But that is less of a leg up than the RIA Services part.

As developers and architects, we need to make good choices based on our requirements. Not just jump on the latest greatest thing that everyone is talking about. If you build on WPF today, you are not really going to be blocked from doing anything you need to do. You might not get all the new shiny toys as quickly because WPF releases with the Framework every few years, whereas Silverlight looks to be sticking to an annual release cycle. But I don’t think any WPF apps are ever going to become stuck in that technology. I think as Silverlight matures even further, we will get to a place where you can just change deployment modes if you want a web based, cross-platform, security context limited version of your app and it will be what we call a Silverlight app today. If you want a deeply integrated version with the desktop you’ll choose a deployment mode that matches what a WPF app is today.

But if you are getting the feeling that you should avoid WPF because it might go away or because Silverlight is the better platform, or that WPF code will become obsolete, I think you are getting the wrong impressions and should rethink.





Sunday, June 06, 2010 12:14:10 AM (GMT Standard Time, UTC+00:00)
Comments [20]  | 


Monday, June 07, 2010 1:09:43 PM (GMT Standard Time, UTC+00:00)
Good post ,but I think (unless I missed it) you left out a *huge* difference; the ability to connect directly to databases.

WPF is for desktop applications, which is still the mainstay of nearly all corporations.

I personally hope that MS has a team that keeps the two products in synch and keeps them from diverging too much, particularly with respect to controls. By this I mean that subsets are expected and OK, but entirely different controls are a bother.
batpox
Monday, June 07, 2010 1:16:39 PM (GMT Standard Time, UTC+00:00)
Brian,

Goodness, I hope the perspective that WPF is dead is rubbish for more than just the next couple years. I can understand people wondering about the future of WPF, though, for these reasons:

- The pace of enhancement for WPF in the last couple years has been glacial. It makes me think all of the development staff has been shifted to Silverlight, since that is the development platform for which Microsoft has competition.

- It's just unclear what scenarios Microsoft thinks WPF is good for and is willing to back that up. When you call a product the "Windows Presentation Foundation", you create an expectation that the product is, well, the foundation of Windows presentation, which means it ought to be very generally suitable for any application that you used to use, say, MFC for. But Microsoft has not delivered on that, IMHO, as evidenced by the fact that they've felt the need to go back and shore up MFC of late. I personally think the key reason is the fact that WPF has a retained-mode-only graphics system. Retained mode is fine for some scenarios (database forms apps), horribly poor for others (data-driven visualization). You can simulate immediate mode using things like InteropBitmap and WriteableBitmap, but those approaches require holding on to multiple copies of bitmaps the size of the client area of your window, which adds up quickly and can start degrading performance. If Microsoft were to put an immediate-mode floor underneath WPF (that didn't have the airspace issues of HWND hosting) based on Direct2D, WPF would have a chance of living up to the expectations it created at PDC 2003.

Thanks,

Eric
small_mountain
Monday, June 07, 2010 3:37:59 PM (GMT Standard Time, UTC+00:00)
Great post Brian. I love WPF and am keeping my fingers crossed that you are correct.

BTW, I can't seem to find the downloadable code for your latest MSDN article 6/2010. The provided URL doesn't seem to go anywhere other than the MSDN code gallery homepage. Any ideas?
Ed Mathias
Sunday, June 13, 2010 10:48:07 PM (GMT Standard Time, UTC+00:00)
For many of us who have to bridge both worlds between desktop and browser-based applications, the idea of using one platform is compelling ... and Silverlight is tantalizing to the extent that one almost wants to shoehorn it into the solution, even when it's not a perfect fit. In almost every case now, the decision boils down to whether I (or the client) can live without the features of WPF, then I will go for the ease of deployment of Silverlight, despite the limitations, for the sake of embracing a single platform.
Tony Pujals
Tuesday, June 15, 2010 8:42:21 AM (GMT Standard Time, UTC+00:00)
I see Silverlight getting adopted in spite of it's limitations, which are well understood, because it has some significant benefits to corporate developers which the first and foremost is centralised deployment. One place the bits live and one place to up date them. For WPF the depreciation of the XBAP and the (often perceived and seldom real) complexity of clickonce mean that the on going cost of Silverlight is lower.

There is also some major advantages being brought to cross platform (native and via Moonlight) that Silverlight has. Considering the Mono guys have zero WPF support means it is off the cards in the hybrid corporate world.

Around the limitations if you go through the list and think of the corporate situation most of those are not a major concern. The rest, like printing, are easily solved. In fact the only one that is a concern there is the Windowing limitations and a bit of out of the box thinking and good UI could solve that.
Tuesday, June 15, 2010 8:56:25 AM (GMT Standard Time, UTC+00:00)
In some ways, it's harder to do silverlight. I constantly miss wpf features like MouseOver and MouseDirectlyOver on UIControls.

In a way, Silverlight is like the take-out menu of a fancy restaurant. It’s the same basic quality, but limited and with better reach.
Thursday, June 17, 2010 7:12:04 AM (GMT Standard Time, UTC+00:00)
ugg boots shop offer powerful training shoes ,Tall ugg shoes. A large number of UGG Tall Boots available at discount Ugg Boots sale are extremely hot recently. Uggs Sale is having its biggest sale of the year.
Thursday, June 17, 2010 7:12:21 AM (GMT Standard Time, UTC+00:00)
Wow - really powerful post. Thanks for taking time to share this personal perspective that not only we as individuals should heed, but organizations as well. Ugg Boots UK becoming more and more popular,new style Ugg Boots will be the best seller for this Christmas,in Ugg Boots Online shopping Uggs on Sale is hot for these years,you canBuy Ugg Boots in here,there are all shopping cheap
Thursday, June 17, 2010 7:14:46 AM (GMT Standard Time, UTC+00:00)
Thanks for sharing ,really helped a lot here! We are the best and professional online retailer, offering top quality Classic uggs sale, Short ugg boots and free shipping worldwide. And we have engaged in uggs shoes sale for years. Buying Sheepskin ugg boots is the best choice to enjoy the benefits.so I said that. Official Uggs online store be established by may retailers, and we have good reputation, competing price and fast delivery. Any questions please feel free to contact us by email or Live Chat.
Thursday, June 17, 2010 7:15:05 AM (GMT Standard Time, UTC+00:00)
Thank you again for all the knowledge you distribute,Nowadays,people pay more attention to high quality life style. High quality means ,comfortable and healthy, very useful womens ugg boots is very popular now.Made from sheepskin, bailey button uggs is very comfortable and warm.It is fit for indoor and outdoor wear.bailey button ugg boots is hot on sale,It is time for you to buy uggs boots for collection.Ugg Boots Cheap is worth for collection
Thursday, June 17, 2010 7:15:32 AM (GMT Standard Time, UTC+00:00)
I agree you! excellent review!vibram five fingers have been popular for a long time,for its excellent quality and further features,I’ve always wanted to have a pair of beauty fivefingers running shoes, yesterday my best friend bought a pair of 2010 fashion vibram shoes ,I feel happy. Then he told me buy suitable shoes on http://www.fivefingersrunning.com , many differ fivefingers kso designs ,also vibram fivefingers kso and more others. The suit shoes win the Customer trust.
Thursday, June 17, 2010 7:15:56 AM (GMT Standard Time, UTC+00:00)
Thanks for sharing !So nice to see you !I will buy a wallet for my best friend! Shopping Cheap EdHardy can be used on various occasions and in different ways. Do you know all these? It’s the time for you to know; It is true that everyone wants to wear the latest trend and wish to buy that pair which is in heavy demand. But it would be better to check what kind of ed hardy clothing that you love.Especial ed hardy hoodies and don ed hardy will improve their appearance.one day i went shopping outside,and in an ed hardy store,I found some kinds of ed hardy sale is hot Thank you for the informationchristian audigier
Thursday, June 17, 2010 7:17:19 AM (GMT Standard Time, UTC+00:00)
I really love your website, it's so useful, i'm just sharing for my friends!Strong winter weather is hitting most of the United States right now. Many of the states that are not used to seeing even the slightest amount of snow, are being bombarded with strong winter weather. If you want to keep warm in this winter
you might try adding some clothes to your inventory like abercrombie & fitch clothing. And The best sell is hollister . In winter Many people are out enjoying this weather while it lasts and snow skiing and snow boarding are two of the most popular winter time sports. Both of these sports require good clothing right? Good . abercrombie and fitch is our best choice.,Womens Abercrombie Fitch is very comfortable and warm.It is fit for all people.now abercrombie Outlet is high It is time for you to buy Abercrombie clothing for collection
Friday, June 18, 2010 4:57:43 AM (GMT Standard Time, UTC+00:00)
Flyff-FR
Have you heard Fly for Fun money, If you played Fly for Fun gold, you certainly know about it buy cheap Flyff penya, you can get Flyff penya, it can help you beat the monster, To some players.
Tuesday, June 22, 2010 6:52:26 PM (GMT Standard Time, UTC+00:00)
WPF is the part of .NET used to render the GUI. Silverlight is the carefully selected essential part of .NET with security enhancements that allow to run code you do not trust. Thus, Silverlight contains part of WPF.

Comparing Slverlight to WPF is less meaningful then comparing apples to oranges. The latter pair can be compared by mass.

So, what "WPF vs Sikverlight"? What "technologies will merge" when they are purposely separated? What are that "people talking about WPF" talking about?


Andrey
Friday, June 25, 2010 6:52:02 AM (GMT Standard Time, UTC+00:00)
Do you know Gil ?if you play the online game,you will know Ffxi gil is the game gold. In the game,if you had more buy gil ,you will had a tall level. But if you want buy ffxi gil ,you can come here and spend a little mmoney to bought Final Fantasy XI Gil .Quickly come here.
Final Fantasy XI Gil
Wednesday, June 30, 2010 4:59:39 AM (GMT Standard Time, UTC+00:00)
"fifa2gold" will bring a player after a century of war, the collapse of the world, to go, in such a world must learn self-protection and look for the fifa2 gold, restoration there are fighting. Player first and foremost task is to rebuild the social order and make enough fifa2 online gold. They also need to take care of their buy fifa2 gold. The game also allows players to carry cheap fifa2 gold, which can be controlled vehicle will also appear in the game. Camp, the game is now known to have fifa2 money, from trying to restore the old constitution's “Enforcer”.
Tuesday, July 06, 2010 9:22:19 AM (GMT Standard Time, UTC+00:00)
nike air max 2009
Wednesday, July 07, 2010 12:48:25 AM (GMT Standard Time, UTC+00:00)
Microsoft Office 2007 can give you more convenient life.
Choose Office 2007 Professional is the most lucky thing in the world.
Many people like the Office 2007 Pro with their work.
Microsoft company invent the Office 2007 home for many people.
MS Office 2007 can change people’s life.
Office Professional 2007 is many people’s favorite.
Buy Office ultimate 2007 you can get many convenience.
The invention of Microsoft Office 2010 is a big change of the world.
By using Office 2010 Professional, you can save your money and time
Office 2010 Pro is the best software of all Microsoft
MS Office 2010 –save your time and save your money.
Many people like buy Office 2010 Home.
Office Professional 2010 is great!
Windows 7 Home makes life beautiful.

Comments are closed.















February, 2012 (1)
January, 2012 (1)
November, 2011 (4)
October, 2011 (1)
September, 2011 (2)
August, 2011 (1)
July, 2011 (1)
May, 2011 (5)
March, 2011 (4)
February, 2011 (2)
January, 2011 (3)
November, 2010 (4)
October, 2010 (1)
September, 2010 (5)
August, 2010 (5)
July, 2010 (6)
June, 2010 (8)
May, 2010 (2)
April, 2010 (2)
January, 2010 (1)
December, 2009 (3)
November, 2009 (2)
October, 2009 (3)
September, 2009 (3)
August, 2009 (2)
July, 2009 (3)
May, 2009 (3)
April, 2009 (2)
March, 2009 (1)
February, 2009 (2)
January, 2009 (2)
December, 2008 (1)
November, 2008 (2)
October, 2008 (5)
September, 2008 (4)
August, 2008 (2)
July, 2008 (1)
June, 2008 (2)
May, 2008 (2)
April, 2008 (3)
February, 2008 (6)
January, 2008 (3)
December, 2007 (1)
November, 2007 (1)
October, 2007 (5)
September, 2007 (1)
July, 2007 (3)
June, 2007 (8)
April, 2007 (2)
March, 2007 (4)
February, 2007 (1)
December, 2006 (2)
November, 2006 (9)
October, 2006 (5)
September, 2006 (3)
August, 2006 (2)
July, 2006 (4)
June, 2006 (5)
May, 2006 (10)
April, 2006 (4)
March, 2006 (2)
February, 2006 (12)
January, 2006 (7)
December, 2005 (2)
November, 2005 (15)
October, 2005 (6)
September, 2005 (7)
August, 2005 (3)
July, 2005 (10)
June, 2005 (11)
May, 2005 (7)
April, 2005 (8)
March, 2005 (6)
February, 2005 (2)
January, 2005 (6)
December, 2004 (3)
November, 2004 (5)
October, 2004 (2)
September, 2004 (5)
August, 2004 (13)
July, 2004 (6)
June, 2004 (14)
May, 2004 (17)
April, 2004 (12)
March, 2004 (8)
February, 2004 (10)
January, 2004 (14)
December, 2003 (9)
November, 2003 (13)
October, 2003 (3)





Sign In
Copyright © 2006-2007 Brian Noyes. All rights reserved.

designed by NUKEATION STUDIOS