This project is read-only.

New project

To get started with Silverlight, you first need to create a Silverlight application, we recommend that you choose to create a Web site for the application as well, to mimic the real world (hosting on a web server). In your project you will have App.xaml and Page.xaml with their respective code-behind files. These are important.

Assembly references

You will need to add reference to the following components found in the release:

In addition, Balder has some 3rd party dependencies. You need to add a reference to the "Ninject.Core.dll" that is located in the distribution as well.

Game class

Add your game class, a standard C# class to the project and name it as you want. This will serve as the entrypoint for the game and the place you will be putting all the initialization and logic for your game. See getting started for details on the game class.


Balder comes with a set of controls that make up the Silverlight representation of the engine. These controls can be added in the Xaml of your page or usercontrol. The root control is called Game and is located in the Balder.Silverlight component under the namespace Balder.Silverlight.Controls.

Lets imagine you have a page like so:
<UserControl x:Class="Balder.Silverlight.TestApp.Page"
    <Grid x:Name="LayoutRoot">


First thing we need to add is a namespace reference so the Balder controls can be used in the Xaml.
Add the following namespace declarations in the UserControl start tag:

Result should be something like this:
<UserControl x:Class="Balder.Silverlight.TestApp.Page"

The next thing we need is a Game control in the Grid, you can even add as many Game controls you want - but keep in mind that it will impact performance. Also keep in mind when adding the Game control that you have to specify With and Height, otherwize you will get an exception during runtime.

<balder:Game Width="800" Height="600"/>

Inside the Game control we can now start adding content.
Assuming you have a ASE file called teapot in your Asset folder (download the attached ASE file if you don't have an object), you can add the following:
<balder:Mesh AssetName="teapot.ase"/>

Keep in mind the AssetName is based upon a root called Asset by default. The internal ContentManager is by default going to look into the Asset folder. Also very important that the "Build Action" of the file has been set to "Resource".

The default Camera position will possibly not enable you to see anything, due to it possibly being positioned within the object itself. So we need to manipulate its position and possibly target.

Add the following within the Game:
    <balder:Camera Position="0,0,-100" Target="0,0,1"/>

You should now be able to see a teapot on the screen in a gray silouette. In order for the object to be properly light, you need to add a light. This can be achieved by adding a control called OmniLight:
<balder:OmniLight Diffuse="Green" Ambient="DarkGreen" Specular="White"/>

Putting it all together:
<UserControl x:Class="Balder.Silverlight.TestApp.Page"
    <Grid x:Name="LayoutRoot">
        <balder:Game Width="800" Height="600">
                <balder:Camera Position="0,0,-100" Target="0,0,1"/>
            <balder:Mesh AssetName="teapot.ase"/>
            <balder:OmniLight Diffuse="Green" Ambient="DarkGreen" Specular="White"/>

Last edited Nov 30, 2009 at 11:37 AM by adept, version 11


adept Jan 12, 2011 at 6:50 PM 
I see that the tutorials need updating.

Please watch this video :
It shows how to do this.

Sorry about the stale tutorials. They'll get better!!!

jelenastankov Jan 12, 2011 at 12:37 AM 
Hello, I get this error: "The name 'TargetDevice' does not exist in the current context". In current version, for Silverlight 3, there is no Balder.Silverlight.Service, and there are no suggestions for using the right package. Can you tell me where can this TargetDevice be found? Or do we have to use something else instead?

adept Apr 24, 2010 at 4:30 PM 
Glad you figured it out.

The next release will only have 2 Balder assemblies

hoinarut Apr 24, 2010 at 10:12 AM 
Well, i just found it myself (i've started a debug session):

{System.IO.FileNotFoundException: Could not load file or assembly 'Balder.Core.SoftwareRendering.Silverlight, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Balder.Core.SoftwareRendering.Silverlight, Version=, Culture=neutral, PublicKeyToken=null'
at Balder.Silverlight.Services.Display..cctor()}

And it is mentioned on the top of this page ... sorry.

hoinarut Apr 24, 2010 at 10:08 AM 
Hello there, first of all congrats for an awesome project! I was trying to get along with it (i am reading the book Packt-Pub now and i am doing the examples from there).
So my issue is the following:
I am copy/pasting code from the book, i downloaded the book's code and samples to make sure i am using the same assembly as in the book ( All compiles, but when i am trying to open the page in the browser i get the exception:

Unhandled Error in Silverlight Application The type initializer for 'Balder.Silverlight.Services.Display' threw an exception. at Balder.Silverlight.Services.Display..ctor()

I am using VS 2010, Silverlight 3.
Please help as i am stuck :(

doncasteel8587 Nov 21, 2009 at 2:31 AM 
Thanks adept, I will keep checking back.

adept Nov 21, 2009 at 1:43 AM 
It has been fixed and will be part of the next release - can't guarantee when it will be out, but hopefully within a couple of days,

doncasteel8587 Nov 20, 2009 at 4:32 PM 
Has the issue been solved allowing embedding the 3D content into a grid or canvas component within a larger Silverlight application?

adept Oct 15, 2009 at 2:09 PM 
This is a feature we had earlier - but we had to take it out due to architectural issues. We are working on it these days, and hopefully within a couple of days it will be back in and you'll be able to put it within any contentcontrol / itemscontrol you'd like.

botma Oct 15, 2009 at 1:42 PM 
How to embed the game into a given grid in my silverlight page?
I downloaded the source code,but found the samples didn't use the classes in the dll's released. such as <Balder:Viewport3D/>,none can be used in my xaml

adept Sep 1, 2009 at 8:16 PM 
Sorry about that. Updated the tutorial now with both issues.

Thanks for your comments!

doncasteel8587 Aug 31, 2009 at 12:44 AM 
Please say set Ninject.Core as a refrence

Instead of.......
"In addition, Balder has some 3rd party dependencies, these are:

You confused me for almost an hour, I could find no way to set a dependency in VS2008.


doncasteel8587 Aug 31, 2009 at 12:18 AM 
I get the following error: "The name 'TargetDevice' does not exist in the current context"

Unless I add "using Balder.Silverlight.Services;" to App.xaml.cs