This is an update to my original article that was based on Silverlight 1.0 alpha. The code for the old article no longer worked with the current Silverlight runtime.
Instead of the traditional and simple display of a string, this Hello World application uses animation in code to say “hello”.
You will need to have the following installed:
- Visual Studio 2008 with Service Pack 1
- Silverlight 2.0 Runtime
- Silverlight Tools for Visual Studio 2008 SP1
Create a New Silverlight Project
- In Visual Studio 2008, choose File/New/Project and select Visual C#/Silverlight/Silverlight Application. The Silverlight project type is added when you install the Silverlight Tools.
- Give your project a name and choose OK.
- On the next dialog window, accept the default “Add a new ASP.NET Web project…” and choose OK.
Silverlight Project Files
Since we will be drawing objects, we need a Canvas control instead of the default Grid. Change your Page.xaml file to read like this:
Press F7 when you have Page.xaml opened to switch to the code-behind file Page.xaml.cs, and replace the code there with this code:
Save the file. Right click on SilverlightHellowordTestPage.aspx and choose Set As Start Page, then run the app.
Hosting the Application
To host the application on your web site, just copy the following files:
Click here to see the application in action.