.net, 3D, Game Development, Silverlight

Balder Release is out

UPDATE 8th of July 2010 : is out – read more here.

Its been a busy month getting all “loose” ends in the Balder project tied up. Hopefully we haven’t left anyone still in here.

For this release we’ve been focusing on bug fixing, cleaning up the APIs and getting better “native” Silverlight support through Xaml. The release and details about it can be foundhere.

Xaml support has been very important for this release, and not only exposing objects and initialization in Xaml, but also being able to manipulate it. The end result is now that you can do a lot of the magic in Xaml without having to touch base with C# at all. For the next release there will be even more focus on this, getting better support for Blend design-time, storyboarding and general editing experience in Blend. But also the support for MVVM style development, so one can get better separation in the code.

We are in the midst of creating tutorials for this new release, as there are major changes and new features that needs some explaining.


C# 4 dynamic and DynamicObject in Silverlight 4

One of the coolest new things with Silverlight 4 is the ability to use C# 4 and in particular the dynamic keyword and infrastructure that comes along with it. The dynamic keyword allows for dynamic typing in .net, which is great for a number of reasons, but alongside it there is something called DynamicObject that makes this a whole lot more interesting for development in environments such as Silverlight.

The DynamicObject is a class one can derive from and override a number of methods, such as TryCreateInstance(), TryInvokeMember() and much more. This can be used for quite a few things, one would be for dynamically invoking services on the server or any other server avoiding the proxy creation all together. The usage from the code invoking the service would only need to call methods as if they were well known thanks to the dynamic keyword.

Working with javascript objects from C# is a second usage, one could create similar functionality for creating javascript objects and invoking methods on them. This is something that I've been working on for a while for Balder – with the next versions of FireFox and WebKit/Safari, they are introducing WebGL. Balder was built for future expansions of platforms, and this is therefor something that comes fairly easy to do thanks to the usage of dynamic and DynamicObject.

One quirk you'll run into, is when using DynamicObject in Silverlight 4 beta, is that you're not having a reference to the assembly were this is located by default, nor is it in the runtime by default. It is in fact located in the SDK. To use the DynamicObject, one needs to add a reference to an assembly called "Microsoft.CSharp.dll", it is located in the Silverlight SDK, typically located here : "C:Program FilesMicrosoft SDKsSilverlightv4.0LibrariesClient".


I'll get back with a future post on how to use dynamic for working with javascript objects – as soon as the next release of Balder is out the door. 


Silverlight 4 beta announced

Today Scott Guthrie announced the beta release of Silverlight 4, the release rate for Silverlight is amazing. Its only been 4 months since we got the release of Silverlight 3 and now everyone is getting their hands on with the beta of version 4, amazing stuff – kudos to the Silverlight development team. I've been working with SL4 for a while now through early access from Microsoft, and I must say that I'm really impressed with what they have accomplished and the quality of the builds has been truly remarkable. I guess a lot of you will probably pick up the downloads and think "why don't they just release it now" or "can I get a golive license for this – like – NOW". 

Download SL4 now and get started over at the "Getting started with Silverlight 4" area of Silverlight.net.

Congratulations to the Silverlight team for their achievement, its a great product and one I'm proud to be representing as an MVP. 

Even though it has only been 4 months since the previous release, the team has been able to get some really great stuff into this version already. Here are the highlights:


Out of browser applications

Silverlight 3 introduced the concept of out of browser, which enabled developers to have their applications installed as an offline application available without having to browse to the page the application was hosted from. In Silverlight 4 there is quite a new features related to this:

Elevated privileges

In Silverlight 4 you'll have the ability to get elevated privileges, this means you get to stuff one is more used to from a regular desktop application:

  • Cross domain network access
  • Full file path from Open/SaveFileDialog
  • No user-initiation requirements for fullscreen, Open/SaveFileDialogs
  • COM Interop


In addition you now have the ability host HTML in your Silverlight application.



Silverlight started out as the "flash" killer on most lips, and with this release as previous they are doing great stuff with media support – closing the gap between what Flash and Silverlight, feature wise.

  • WMS multicast support
  • MP4 playback protected by PlayReady DRM
  • Offline DRM
  • Output protection
  • WebCam/Microphone support (raw stream only)


Printing support

Finally – this feature is something that at least I've been missing since day one, the ability to programatically generate print documents from the client without having to rely on doing it on the server and pushing back to the browser.



One of the coolest features with Silverlight is text – the ability to embed true-type fonts and assure the look across browsers and platforms. With Silverlight 3, they close to perfected the rendering of fonts, with this release we're therefor seeing some new and cool features:

  • RichTextBox
  • Arabic and Hebrew support (right to left)
  • IME Improvements for TextBox
  • UIElement.TextInput event


Controls / Layout

The gap between WPF and Silverlight is really getting tighter in this version:

  • Theming via implicit styles
  • ViewBox
  • MouseWheel support on ScrollViewer, TextBox, ComboBox, Calendar, DatePicker
  • RTL Layout via UIElement.FlowDirection property
  • VisualStateGroup.CurrentStateGroup property
  • Command Property on ButtonBase & Hyperlink (finally)
  • SelectedValue and SelectedValuePath properties on Selector



  • Memory usage fix during progressive downloads
  • Automatically adding referrer header
  • Authentication support on ClientHttpWebRequest


Tools support

Dispatcher support on the tools design surface


DataBinding improvements

  • DataBinding support for DependencyObjects
  • IDataErrorInfo support
  • StringFormat, TargetNullValue & FallBackValue properties on Binding
  • ObservableCollection<T> constructor that takes INumerable or IList
  • IEditableCollectionView
  • Grouping support on CollectionViewSource



  • Astoria 2.0 Support
  • MEF



  • Expose runtime version to 3rd party DLLs
  • NGEN support for Core runtime binaries


Also, important to know; Silverlight 4 supports C# 4, so when doing Silverlight development from Visual Studio 2010, you'll be able to use all the cool new language features in C# 4, dynamic being one of my favorites. 


Breaking changes from SL3

TabControl keyboard navigation fixed

In SL3 navigation was broken, pressing the up key used to activate the next TabItem and down the previous, counterintuitive when TabStripPlacement was Left or Right. In SL4 pressing the up key activates the previous and down activates the next. In order for existing applications to take advantage of this fix you'll have to recompile the application.

Toggling fullscreen mode will now result in rerunning hit-testing

Controls that were under the mouse before toggling fullscreen will get their MouseOver state refreshed from rerunning the hit-testing.

Windows class

The property called WindowStartupLocation is not returning a string anymore but a WindowStartupLocation object.

Class MS.Internal.Interop.IneropWrapper has been removed

Changing DisplayMemberPath and ItemTemplate properties of ItemControl now re-creates all containers

Setting ItemTemplate and DisplayMemberPath had no effect after ListBox measuring was finished in Silverlight 3. This will now invalidate all realized containers and re-create them even after the containers were measured.


Tim Heuer has a great guide on his blog for the new features that can be found here



.net, Balder

Upcoming Balder release

My blog has been dead silent lately. The reason for this is that I'm quite busy getting a new release of Balder out the door. 

For the upcoming release, which will be named 0.8.8 – still in Alpha mode, I've focused a lot on code quality and getting some debt paid back from the "early" days when I started the project. But fear not, there is also a bunch of new features coming.

To mention a few things:

– Mouse interaction with objects, an event model

– Simpler initialization – in fact, there is none

– A better declarative Xaml model that replicates the object model found in Core – they are separated, due to cross-platform support that will come.

– The ability to have more than one displays – great for Silverlight when you want to have multiple 3D models on the same page, but not interacting with each other

– Command support – so one can actually do MVVM style 

– Debug information – bounding spheres 


 In addition there is tons of bug fixes, such as:

– Coordinate system was out of wack. Positive Y was pointing downards, now pointing up

– Initialization bugs that occured from time to time

– Speedups – rendering pipeline has optimized a tad, and the initialization phase as well.


There are a few breaking changes there as well in the API – its gotten a bit cleaner and more concise.


A detailed description of all this will come in the release notes.   Keep your ears to the ground, cool stuff will come soon.