Share via


Endless possibilities with WPF - But don't forget the basics

Have you already had a look at the next generation UI Framework included in WinFX shipping in the Vista timeframe? It's called Windows Presentation Foundation (WPF) and the in short the bullet points of WPF are:

  • Unified approach to user interface, documents and media with one programming model
  • Vector based composition engine utilizing the power of modern graphics hardware.
  • Declarative programming model that allows layering of applications and the possibilities for designers and programmers to work on the same code and integrate desigenrs into the application development process.
  • Ease of deployment by leveraging the smart client deployment model known from Windows forms programming.

One of the biggest pros for WPF is that it introduces a hierarchical layering of UI elements so that you are no longer bound to standard controls that always have a common design. And if you want to get some individualism into your application you are forced create your own UI controls which causes quite some effort the way it's currently done. Those times are over with WPF.

With WPF a button does not need to look like a button it just has to behave like one. Just use whatever UI representation you like for it. Use opacity masks, colours, shapes, transformations, or any other predefined WPF control inside your button control to make it look the way you would like it to look. With this example it becomes clear that the possibilities for UI design, usability and ergonomics are almost endless. But like always if possibilities are endless this also introduces the chance to overdo it. Don't forget the rules and principles of the attributes mentioned above and don't forget that if now the system is able to use all the graphics computing power it also introduces the necessity to think about the target groups of the application and how many horsepower the PCs have that such people normally use.

For example with WPF to include a video ressource into an application is as easy as writing the codeline

<MediaElement Source="URL"></MediaElement>

Do that three, four or even more times in your application you will easily employ most of the ressources an average PC has and if the media resource is streamed via Internet it also eats up much of the bandwith of a standard internet connection. I tried 16 buttons of which every single one of them displayed a inline videostream. My Toshiba Tecra M4 was only able to handle 5 of them...the other 11 stayed black. Same applies to 3D content when targeting people that usually don't belong to the 3D gaming community.

So the advice I would give is to think carefully about the the people you target for your application and investigate what equipment those usually use and by any chance use the guidelines and tools mentioned in the "Profiling Performance in WPF Applications" lab available on:

https://msdn.microsoft.com/winfx/learning/presentation/hands_on_lab/default.aspx

You can find more performance related information in the Blog of Tim Cahill

https://blogs.msdn.com/timothyc/default.aspx