Microsoft & .NETImplementing an Out-Of-Browser Application in Silverlight

Implementing an Out-Of-Browser Application in Silverlight content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.


In this tutorial I will show you how to implement an Out-Of-Browser application in Silverlight. I have included source code within this article if you want to actually try it out yourself. The source code was created using Silverlight 4.0 and Visual Studio 2010.

What is an Out-Of-Browser Silverlight Application?

It is commonly assumed that Silverlight applications are strictly meant to run on the browser, which is not true. A Silverlight application can be enabled to run Out-Of-Browser, and users can install the Silverlight application on the client, just like a desktop application.

Out-Of-Browser Settings

In this section we will learn how to enable a Silverlight application to run out of the browser. Below are the initial steps:

  1. Using Visual Studio 2010, create a Silverlight application named OutOfBrowserDemo.
  2. Add the hosting web project as well.
  3. Right click on the Silverlight client project and select Properties.
  4. Tick the checkbox “Enable running application out of the browser” as shown in Fig 1.0
  5. Fig 1

    Fig 1.0

  6. Click on the Out-Of-Browser Settings button to set the below properties for the Out-Of-Browser application.
    • Width & Height of the window
    • Location of the Window
    • Window Title
    • Shortcut name
    • Application Description
    • Window icon
    • To use GPU acceleration or not
    • To show install menu or not
    • Elevated trust required or not

Fig 1.1 Shows the Out-Of-Browser settings window

Fig 1.1

Fig 1.1

Hence, enabling a Silverlight application to run Out-Of-Browser is as simple as that.

Installing a Silverlight Application on the Client

In this section we will see how the user can install the Out-Of-Browser Silverlight application on their computer and also how a developer can customize the installation process.

Add the XAML code below to MainWindow.xaml.





d:DesignHeight=”416″ d_DesignWidth=”538″>

What is the Install Option on the Browser?

In this section you will see how the user can install the application directly from their browser. First, run the Silverlight application host web page. Right click on the Silverlight section of the page and you will find the option “Install onto this computer” as shown in Fig 2.0. Clicking on it will install the application on the computer.
Fig 2

Fig 2.0
The only disadvantage with this approach is that the user won’t be able to see that an Out-Of-Browser option is available until they right click on the browser.

Custom Implementation of an Out-Of-Browser Silverlight App

You can also control the installation process through code. Add the implementation for the button click event. Below is the source code:
namespace OutOfBrowserSilverlightApp
public partial class MainPage : UserControl
public MainPage()


private void SetView()
if (Application.Current.IsRunningOutOfBrowser)
InstallButton.IsEnabled = false;
WelcomeNoteTextBox.Text = “This application is running in a Out-Of-Browser mode now”;
InstallButton.IsEnabled = true;
WelcomeNoteTextBox.Text = “This is application is currently running on the browser”;

private void InstallButton_Click(object sender, RoutedEventArgs e)
if (Application.Current.InstallState == InstallState.NotInstalled)

private void UnInstallButton_Click(object sender, RoutedEventArgs e)
Application.Current.InstallStateChanged += new EventHandler(Current_InstallStateChanged);

void Current_InstallStateChanged(object sender, EventArgs e)
Run the application and click on the installation button. You will be prompted with an installation dialog. Click on yes. Now you will see that the application is installed in the client and running in an Out-Of-Browser mode as shown in Fig 3.1.
Fig 3.1

Fig 3.1

Uninstalling the App

Eventually the thought of uninstalling the application comes into the picture. There are two options available:

  1. When you right click on the browser’s Silverlight area now you will get an option saying “Remove this application”. Use that to uninstall the application.
  2. Go to Add or Remove Programs in the Windows Control Panel and uninstall as you would do with other installed programs.


This article was intended to clearly explain how to implement an Out-Of-Browser application in Silverlight. Let me know through the commenting form below if you need any further clarifications on the topic, and if you would like me to cover any other particular topics about Silverlight, be sure to mention them as well.
Happy Reading!

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories