Infosys Microsoft Alliance and Solutions blog

« "Oslo" Repository's Design Support for Schema and Data Versioning | Main | Caching Controversy!!! »

WPF, XBAP, Silverlight - What do I use?

Microsoft introduced Windows Presentation Foundation (WPF) with .NET framework 3.0. What started as extensions to Visual Studio (VS) 2005 is a now a in-house native to VS 2008 and the VS 2010 designer is itself getting implemented in WPF (more details in Jason's blog here).

Needless to say that WPF is very powerful new presentation platform that really makes "imagination is the limit" a reality. Designers and developers can now work real closely like never before and create some really super cool user experiences.

Anyway, I am not planning to use this blog for explaining what WPF is all about. You can find many online articles on the same. WPF is native to .NET framework now and allows one to create thick client applications. However Microsoft didn't stop there and they had the support for XAML Browser Application (XBAP). XBAP is pretty much same as WPF and requires full .net framework on the system to run, but it runs in the browser security sand box.

Since WPF was targeted towards thick client, it was probably expected that MS will come up something that is for thin client applications. XBAP isn't really thin client since it needs full .net framework on client side. So we soon had Silverlight (SL), which is a sub-set of WPF (and fits snugly into a just around 4 MB download). Interestingly with SL 3, MS is adding the out of browser support for SL.

Given that SL really runs on the client side and uses WCF primarily to get server side data (unlike ASP.NET which runs on server side), SL application can continue to run even if there isn't a network connection, till the time one really makes a server call to pull/push data. Anyway, MS really took this forward but adding features that allows one to detect network connectivity and also take SL applications out of browser to give the real offline application scenario.

Now does this compete with WPF? Not really, since SL is a subset and you can't do all that you do in WPF, but for your typical business/departmental application, you would most likely anyway not use all features of WPF (some of them may still be restricted to game vendors). Hence the question really is where to use WPF? Where to use XBAP? Where to use SL? Where to use SL out of browser support?

If you are reading this for getting an answer to this, I regret to disappoint you, but I am also really looking at seeing how you are making use of these technologies. To me personally, there hasn't really been a real solid reason to do XBAP over WPF. Similarly people ask for offline support, but I am not convinced. If you can't connect, all your data isn't available and if you really want to cache some and do offline, then why not use WPF itself. People say that offline still allows you to target many different operating systems as against a full version of .net and WPF that will run only on windows, which seems reasonable.

However I will really like to hear from all you people out there as to what are your decisions points to select between WPF and XBAP and SL and offline SL? And do you think offline SL will impact usage of WPF?


Yes. Offiline Silverlight would impact the use of WPF, but to a little extent and not to the extent that it will override WPF.

So now the question is when to choose WPF, XBAP or Silverlight?

The criteria to choose an answer should be mainly dependent upon the client (user). How much pain you would want to give to your user to access the application.

The best platform to choose will always be Silverlight because of its cross browser, platform support and thin client model.

But then, think how complex is the application and whether Silverlight has enough features to develop the application in the given time. This should be your second criteria to choose the platform.

For example, If the application is little complex and cannot be done with Silverlight but can be done with WPF or XBAPs, then go with XBAPs. XBAPs need .Net framework to be present on the client machine. By the way, XBAPs security model is not strong. So watch out.

The last: When to choose WPF? WPF necessitates the presence of the application (typically an exe) on the client and sometimes it would even need an installation of the application.

If you need to use the high 3D graphics, complex features and controls of WPF, then go with it. Or else, if you are developing an application which you would want to run as a stand alone (i.e., in cases where the user is not always on network), go with WPF. Now in this case, you would question: Why not Offline Silverlight than WPF? Well, Offline Silverlight has a long way to grow up. At least more than a year. How much time did Google Labs take to get Google Gears into the market?

Isn't it a case of intranet v/s internet application? If the client is looking at deploying a browser based RIA solution within intranet, I guess XBAP makes perfect sense; especially as it needs full .NET framework availability.

@Shivaji, interesting points.

@Nitin, Mostly yes, but even in intranet, there can be a mix of operating systems like Windows, Mac, Linux etc. .NET Framework won't install on all of them and hence XBAP won't always work.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter