The Silverlight 5 beta was made available a couple of weeks ago (http://www.silverlight.net/getstarted/silverlight-5-beta/). Most of the features had been telegraphed in December at the Microsoft Silverlight firestarter which appeared to have been hastily organised to try and fend off criticism that Silverlight was being deprecated in favour of HTML 5.
Certainly there was, and still is some confusion as to what the purpose of Silverlight is. It was originally sold to us as a cross-platform browser independent platform. That now seems to have changed and it is HTML 5 is the cross-platform browser independent platform. Unfortunately the tooling to support developing HTML and JavaScript is absolutely appalling in comparison with the outstanding tools for Silverlight.
Based on this, a website that I was developing for a customer was going to have all the public parts written in HTML and the pieces where you need to login written in Silverlight. I have now changed that and completely removed Silverlight from the project and it will all be in HTML.
So why would anyone use Silverlight? This is a good question, if you want to have a rich application that can make use of the available hardware, why wouldn’t you build a WPF application? Well partially because WPF appears to be completely on the scrapheap. The WPF Toolkit hasn't even been updated to support visual studio 2010 and the .net 4 framework!
My previous post on LightSwitch described how they had chosen to use Silverlight rather than WPF for desktop applications. This appears to be what Microsoft wants you to do, with continued improvements in full trust and multi-window support.
So what's new in Silverlight 5 that isn't available in WPF:
- XAML Debugging with breakpoints for binding debugging. This looks outstanding!
- Double (and multi) click support
- GPU-accelerated XNA-compatible 3D and immediate-mode 2D API
- RichTextBox overflow
But there has been no word on when or if any of these features will be available in WPF. Why is there not a new release of the WPF Toolkit with the 3-D and 2-D API available? Those of us who have invested massive amount of time in developing 3-D software using WPF (in my case for the 360° panoramas in the virtual tours) have to start from scratch, yet again! Whilst it may be a good move to use XNA, as it is available on multiple platforms, it means that people working in both WPF in Silverlight have two different Apis to write for.
The RichTextBox overflow is completely baffling to me, why did they just not port flow documents?
There are also plenty of features already in Silverlight that are not available in WPF:
- DeepZoom
- Ria services - to use this you have to create a WCF service and you don't get all the advantages that you do when working with it in Silverlight
- HyperlinkButton
- ChildWindow
- UriMapping
It appears from some rumours that Silverlight will be the primary programming language for Windows 8, once again suggesting that WPF has a limited future, which may be why these features have not made it into WPF.
What’s still missing from in Silverlight from WPF:
- MultiBinding (see here for an alternative)
- Preview events (in WPF all events such as mouse button down have a preview event that runs down the visual tree)
- Triggers
- FlowDocuments (see here for my attempt at FlowDocuments)
- RoutedEvents
- BooleanToVisibilityConverter
- GroupBox
- Toolbars
- Expander
- Commanding infrastructure
- Default set of brushes
- Many ToolTip options
- I'm sure there are more than I have missed.
All of these make developing Silverlight a lot harder and you often find yourself hacking around the lack of these features. I have built a library to try and ease this, but you are forced to have separate xaml between the two targets because there are so many things not available in both.
To top this off, there is a new release of Silverlight for the Windows phone, but that is only Silverlight 4!
If, like me you are building an application for WPF, Silverlight and Windows Phone, this just makes life incredibly difficult because across all three platforms there are features that are available in completely different ways!
One wonders why people at Microsoft don't sit down and talk to each other and try and make these things simpler for developers, especially since some developers are likely to abandon WPF because of the complexity of trying to manage Silverlight and WPF development, or developers like me will abandon Silverlight development for public facing websites.
There are certainly some good new features in Silverlight 5, but I hope that the various teams at Microsoft will start talking to each other and create a more cohesive development platform. With Google already way ahead on the phone market and wanting to get into the operating system market Microsoft really have to up their game.