Creating desktop apps with Silverlight

By : |August 20, 2009 0

BANGALORE, INDIA: Silverlight 3 Beta enables youto run and create applications for your desktop, which means you can use them without Internet connectivity. You can store and use Silverlight apps locally without having to download extra plug-ins. Besides, Silverlight 3 based apps are able to detect Internet connectivity and react intelligently like caching user data, etc. As these applications run inside a secure sandbox environment with persistent isolated storage, they are quite safe to use.

To build a Silverlight 3 based app, you need either Visual studio 2008 SP1 or Visual Web Developer Express 2008 SP1. In this implementation, we have used the latter. Now to add Silverlight 3 application building capability to this IDE, download and install Silverlight 3 Beta Tools for Visual Studio from
This will install the runtime and Silverlight 3 Beta SDK. We have used C# as programming language in this demo. Now start Visual Web Developer and create new ‘Silverlight Application’ project (‘SilverlightApplication1’). You need a Web page to host this application, therefore Visual Web Developer Express 2008 prompts either creation of test page or a complete ASP.NET project.
We created ASP.NET project named ‘SilverlightApplication1.Web’ in this implementation. From the solution explore open two files ‘MainPage.xaml’ and ‘MainPage.xaml.cs’. These are two files that define structure and logic of a Silverlight application. Here is the sample structure of ‘MainPage.xaml’ file:

<UserControl x:Class="SilverlightApplication1.MainPage"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel MouseLeftButtonDown="Mouse_Clicked">
<Storyboard x:Name="Storyboard1">
<ColorAnimation Storyboard.TargetName="SolidColorBrush" Storyboard.TargetProperty="Color" From="Gold" To="Silver" Duration="0:0:4" />
<SolidColorBrush x:Name="SolidColorBrush" Color="Gold" />

[image_library_tag 932/16932, height=”152″ width=”250″ border=”0″ alt=”” ,default]

To install Silverlight app locally, simply right click on browser window and click on Install. As shown above, one can add a shortcut to the desktop and Start Menu.

In this application, we have created a button click event ‘Mouse_Clicked’ and storyboard named ‘Storyboard1’. This application creates animation on left mouse click. With this event, the Gold color in browser will change to Silver in four seconds. Here is the sample code of ‘MainPage.xaml.cs’ file that simply initiates animation :

using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SilverlightApplication1
public partial class MainPage : UserControl
public MainPage()
private void Mouse_Clicked(object sender, MouseEventArgs e)
{ Storyboard1.Begin(); }


So far, this application looks like any other Silverlight application. To make this application run from your desktop, you need to change ‘AppMainfest.xml’ file present under ‘Properties’ in solution explorer . Here is the content of this ‘AppMainfest.xml’ file :

[image_library_tag 933/16933, height=”236″ width=”300″ border=”0″ alt=”” ,default]

Here is thesame Silverlight app running from your desktop in a window titled ‘Silverli ght Animation – localhost ‘. To remove it, right click and click ‘Remove this application’.

<Deployment xmlns=""
ShortName="PCQuest out of Browser Silverlight Application"
Title="Silverlight Animation">
<ApplicationIdentity.Blurb>Simple anuimation</ApplicationIdentity.Blurb>

Here ‘<Deployment.ApplicationIdentity>’ contains information like short name that appears as name of shortcut, title that appears in the title bar, blurb for more information, and optional icons for defining customized icons. When we run this application, it runs in the default browser window. To make this application run out of window, right click on browser window and click on ‘Install PCQuest out of Browser Silverlight Application onto this computer’. This action will install application on your computer and prompt user to add a shortcut to desktop and Start Menu. Now close your browser and click on desktop shortcut (‘PCQuest out of Browser Silverlight Application ? localhost’). This will open same application out of browser locally and there is no need for Internet connection. The moment you get connected to Internet, this application goes back to the server to check for updates. The application will notify the user if a newer version is available.

If you want to remove this application, simply right click on out of browser window and click on ‘Remove the application’. Silverlight 3 Beta also comes with improved audio and HD video support, 3-D graphics and pixel shading effect, and enhanced data

No Comments so fars

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.