This tutorial is recommended as a starting point for learning to create modules for SilverlightDesktop.
To use this tutorial you need to have Visual Studio 2008 installed and Silverlight Tools for Visual Studio 2008
Step #1: Install the "Install version" of SilverlightDesktop.
You do not need to use the source code version of SilverlightDesktop to make modules. In fact it complicates things. Altering the SilverlightDesktop core will also cause problems because you won't be able to upgrade your SilverlightDesktop site if you change the core source code. The proper way to enhance your SilverlightDesktop site is to create modules.
You can find help in installing SilverlightDesktop here:
Step #2: Open the SilverlightDesktop site and build it
Open Visual Studio and then open the SilverlightDesktop website by selecting File then Open Web Site...
The site will open.
From the toolbar, select Build then Build Web Site.
The site should build without errors.
Step #3: Create the HelloWorld Project
From the toolbar, select File then New Project.
In the New Project box:
- Select Silverlight under Visual C# (under Project Types)
- Select the Silverlight Application template under Templates
- Enter HelloWorld for Name
- Select Add to Solution for Solution
- Click the OK button
On the Add Silverlight Application box:
- Select Link this Silverlight control into an existing Web site.
- Choose the SilverlightDesktop website in the Choose existing Web Site drop-down
- Check only the Enable Silverlight debugging box
The HelloWorld project will be created.
Double-click on the Page.xaml file to open it in the editor. Replace ALL the code with the following:
<Canvas x:Name="LayoutRoot" Background="White">
<TextBlock Height="Auto" Width="Auto" Canvas.Left="10" Canvas.Top="10" Text="Hello World!" TextWrapping="Wrap" FontSize="24"/>
From the toolbar, select Build, then Build Solution
Notice the HelloWorld.xap file is now in the ClientBin folder of the SilverlightDesktop website.
Step #4: Register the module
Navigate to the first page of the SilverlightDesktop through the web browser. Click the Login link.
Log in as an administrator.
Click the Go to Administration link.
Navigate to the Module Settings page and enter the following settings on the last line and click the Insert button.
- Name: Hello World
- Description: Displays Hello World
- Assembly: HelloWorld.xap
- Class: HelloWorld.Page
- Icon: null
- Role: Any
- WindowSize: 80
- Version: 0
Navigate back to the first page and then click the Go to your SilverlightDesktop link.
The Hello World button will display and when you click on it the module will show.