Silverlight 4 Quick Tip: Out-Of-Browser Improvements

March 15, 2010

This post will focus on improvements (well some of them) in Silverlight’s 4 RC Out-Of-Browser features.

I’ll show how to change shape of your Out-Of-browser (OOB) application.

Note: the application has to be elevated application.

All needed to take application out of browser is to check this small checkbox in Silverlight’s project settings:


This is not new. But the combo in OOB Setting dialog is new:


This allows to change the Windows shape in Elevated OOB applications.

Small tip here: when you changing you window to be Borderless (Round Corner or standard one) to have decide how your application will be moved across the screen and how it will be closed.

To close elevated OOB use the following snippet:

if (Application.Current.IsRunningOutOfBrowser && Application.Current.HasElevatedPermissions)

To move the application, subscribe to MouseLeftButtonDown, MouseLeftButtonUp and MouseMove events. Here is the sample to handle those events and let your application move around the screen:

bool isDragged = false;
private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
   if (Application.Current.IsRunningOutOfBrowser && !isDragged)
      isDragged = true;

private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
   if (Application.Current.IsRunningOutOfBrowser && isDragged)
      isDragged = false;      

private void UserControl_MouseMove(object sender, MouseEventArgs e)
   if (isDragged)

Additional feature exist with new OOB model is ability to install application not from the web page (like it was from version 3), but from command line (having XAP file available). Silverlight 4 OOB launcher has new command line parameters to install, uninstall and execute application in “emulation mode” – without installing it.


For example. to install application on the desktop use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /install:"X:\PACKAGE_LOCATION\SL4Features.Web\ClientBin\APPLICATION.xap"

/origin:http://ORIGINAL_LOCATION/ORIGINAL_HOSTING_PAGE /shortcut:desktop

To uninstall it use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /uninstall:"X:\PACKAGE_LOCATION\APPLICATION.xap"

/origin:http://ORIGINAL_LOCATION/ORIGINAL_HOSTING_PAGE /shortcut:desktop

To run application without installing it (in emulation mode), use the following command:

"%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe" /overwrite /emulate:"X:\PACKAGE_LOCATION\APPLICATION.xap" /origin:http://ORIGINAL_LOCATION/


Last, but not least, now you could execute and debug your OOB application directly from Visual Studio 2010 without installing it first. It is as simple, as setting it as “StartUp Project”:


Next time I’ll show more new features in “just-released” Silverlight 4 RC.


Stay tuned,


Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. Blake Harbison June 30, 2011 ב 3:15

    I’ve even considered this question previously, but have not arrived the result, Sigh ~

  2. Nitin20TechNovember 24, 2011 ב 9:07

    thnx….my desktop app is working now