Silverlight 5: does anyone at Microsoft talk to each other?

by StefanOlson 25. April 2011 12:11

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.

Tags:

Silverlight | WPF

Comments

4/26/2011 1:52:18 AM #

The press makes it sound like there must be only one form of communication across groups in Microsoft: the death threat.  It sounds like a big battle royale over there.  Microsoft's words and actions do nothing but reinforce this image.  It's Windows vs .NET vs IE in a fight to the death, with developers caught in the middle while the competition slowly relegates Microsoft and its legacy to the history books.

I work on an app that is far too complex to do in HTML.  Until SL5, it wouldn't have been possible in SL either because it needs true 3D support.  It's WPF for now, but I agree with you that the future of WPF seems bleak indeed.  I wouldn't totally base it on the WPF Toolkit (not a very good project in the first place) but it's bleak on all other fronts except for the occasional ray of hope from Pete Brown.

Fortunately WPF seems to already have everything I really need (to run on the Windows platform).  I can still count on customers having or obtaining a Windows PC or VM to run this app, and it should be enough years before Microsoft decides that WPF applications shall no longer run on the latest version of [x86] Windows.  So even if WPF is stuck in minimal maintenance mode for the rest of its life, although that would be a shame, it'll still get the job done.  A lot better than JavaScript and WebGL would.  Ugh.  And still better than SL would.

By the way, I think you're not quite right about doubleclick support.  WPF has had it from the beginning, has it not?  And not some hacky method like in SL5 but the normal thing one would expect:
msdn.microsoft.com/.../...ol.mousedoubleclick.aspx

And a 3D API?  WPF has WPF3D!  Hahaha.  No, actually, it has some very good Direct3D interop.  I've been happy using Direct3D directly (via SlimDX), even if it has been some extra work.  I expect I may end up writing a SL (XNA) renderer for my 3D engine at some point, just like I may write an OpenGL renderer if I go cross-platform via Mono.

When APIs differ, it's up to us developers to create layers that abstract out the differences based on the needs of our applications.  Not always practical (UI??) and a lot of extra time we'd rather spend on our application features, but the easy cross-platform holy grail remains firmly out of sight for all but the most trivial apps...

Tom

4/26/2011 8:55:31 AM #

Tom,

I think the kind of application that you are talking about where it is too complex to do it in HTML is really the main scenario that Microsoft are really focusing on for Silverlight in websites - the addition of 3-D gives it a substantial advantage over using HTML.  But how long until WebGL gets support from the IE team and we have all these horrible pieces of JavaScript to work with 3-D?

Yes, WPF has double click in the way that you would expect. My point was that it is incompatible with the way they have done it in Silverlight, so you end up with two diverging pieces of code to write the same application for both.  Yet again they chose a completely different way to do things in Silverlight than they have chosen to do it in WPF.

I suspect your comments about using direct 3-D are the reason that they have chosen to use XNA in Silverlight.  For what I needed to do the 3-D API was reasonable, if not great, but it sounds like you may not have had the same experience. Interestingly if you do build a Silverlight renderer for your 3-D engine in future versions of WPF you will be able to just drop in a Silverlight control and integrate it into your WPF application. This suggests to me that Microsoft have no interest in creating a platform that can be single sourced across both.  After all, if you could do that, why would there be need to use a Silverlight control?

As I mentioned, I would have expected an XNA based engine for WPF, which will avoid you needing to create a Silverlight version.

Will be interesting to see what Novell decide to do - whether they build an XNA to OpenGL layer to allow mono to have Silverlight 5 support, or if they just leave out that part.

I absolutely agree that cross-platform is still a while away.  It is now made more complicated by the fact that if you want to develop phone applications, and you want to make money you have to develop for android or iPhone, where .net is not available except via the two mono versions MonoDroid and MonoTouch, but you still have to develop user interfaces in a non-cross-platform fashion.

I think the disappointing thing is the fact that Microsoft have the ability to make it simple to develop across the desktop, the browser and the phone but it is still far more difficult than it should be.

Thanks for your comment.

...Stefan

StefanOlson

Add comment




biuquote
  • Comment
  • Preview
Loading



About the author

Stefan Olson is the Managing Director of Olson Software.  He has been developing software using Microsoft Technologies for nearly 20 years.

He is currently working on building the next generation Virtual Tour software in WPF and Silverlight for www.palacevirtualtours.com.