Silverlight 4 beta and my disappointment with the WebBrowser control

Silverlight 4 logo by Tim Heuer So as most of you probably know by now, Silverlight 4 has been announced and a beta is already released, you can head off over here to find out what’s new and to download the bits you need like Visual Studio 2010 Beta 2, etc. One big warning though, if you have the Silverlight 3 SDK installed on your machine, uninstall it before installing Visual Studio 2010 as it might barf the Visual Studio 2010 installation.

So one of the features I’ve been eagerly awaiting in Silverlight 4 is the new WebBrowser control. Yeah as strange as it may seem I want to embed some web content in a Silverlight control. Well not a control as such but more a Silverlight application. And I’ve managed to do it since Silverlight 2 by creating iframe elements in the underlying HTML DOM and absolutely positioning them over my Silverlight control, all from within the Silverlight application. This has however one major limitation – you can’t put Silverlight content on top of the HTML iframe unless its in a seperate object element which doesn’t exactly suit my needs.

Silverlight 4 WebBrowser doesn't play niceAnd it turns out that the Silverlight 4 beta WebBrowser control suffers the same horrible fate, as you can see in a screenshot of a quick test application on the left. Except it has another awkwardness to it – it has to be run out of the browser as well. Looks like I’ll be sticking to my iframe approach for in the browser and consider using the WebBrowser control for out of the browser only.

Now don’t get me wrong, I do like the new control, but I would like it to be even better. If anyone on the Silverlight team reads this, please make the WebBrowser control a proper Silverlight control that can have pure Silverlight controls over it.