Cool new features in WPF 3.5 Service Pack 1

Microsoft has released a new service pack for .NET 3.5 and Visual Studio 2008, containing some pretty cool features. A lot of them can be found in WPF which has gotten quite a few fixes and additions that are really useful for developers who are using WPF today.

In this post I will show some of the interesting new features, not all will be explained that detailed, but it’s more to get an idea of what is going on. The most interesting features will be shown here, others can be found on MSDN.

Splashscreen

The startup of WPF applications is kind of slow, especially when you perform a cold start. For really large applications this isn’t really a problem in my opinion (I can hear you think: What is he talking about?!?). The slow startup with large applications is understandable for users, but it is always best to have the application startup fast with a splashscreen or something, just to let the user know it all works and he just needs to be patient for the application to start.

Microsoft introduced the splashscreen build action for this. You can add any kind of static image to your application and set the build action to SplashScreen. What the compiler will do is create a new splashscreen for the application based on the image and display it when the application starts. Pretty cool if you ask me.

Note: The splashscreen does not support XAML or anything that animates. Also note that the cold startup does not actually improve. The image will show rapidly, but the main form still requires a bit more time to load.

Improved debugging experience

The debugging experience is improved greatly with SP1. Before this service pack, errors in the XAML were either displayed without any reference to the code or were displayed within the code that was generated from the XAML. Both solutions weren’t really all that and I was quite frequently frustrated that stuff was showing up so badly in the debugger.

With SP1 things have improved and stuff that is wrong in the XAML is shown in the XAML where it belongs. This is a big step forward and will make life a lot easier for developers.

Improved refactoring support

Refactoring support is an important feature for me as I first build a very raw prototype UI and refactor that prototype into something that I can work with and is more easy to maintain. During this process I move stuff around, rename things and delete things. Previously you had to manually keep the XAML and code in sync when renaming stuff. Not anymore, Microsoft made it possible to rename stuff in code and the same component is also renamed in the XAML.

Performance

There’s more things in the performance area that are improved with the servicepack. The first thing they did was the splashscreen, although not actually a performance improvement, it does show an increase in perceived performance to the user. Which is of course important too.

The other performance improvements are largely found in rendering of text and effects. More effects are now hardware rendered and they have included an api to write your own shader effects, which can be rendered with any 3D graphics card that supports them.

Data and Databinding support

One of my favorite areas in WPF is databinding, it’s so easy to bind objects to the user interface that I can’t live without it. Windows Forms simply doesn’t cut it for most tricks I perform in WPF with databinding. They improved quite a lot in this area

  • Alternating rows in controls derived from ItemsControl (Which are a lot of controls)
  • IEditableCollectionView – Makes it possible to edit items in a collection view in a transactional manner
  • StringFormat support in {Binding} expressions, previously you needed to use a value converter for this, but now it’s buildin

Direct3D

Last but not least, they added interoperability support for Direct3D. I’m not much of a 3D guy, so I take this one for granted and will take a look at it once I’ve got to use it ;P It looks pretty neat, you can map 3D scenes rendered in Direct3D on to images or even textures in WPF. This allows for more cool scenarios and new ways to present information to the user.

Conclusion

Microsoft could have called it WPF 3.6, there’s loads of new stuff included, most of which developers of rich business applications will most likely use as soon as they start building WPF applications. I think we can congratulate the WPF team on yet another great release.