Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Silverlight 3 – Taking Silverlight Out of the Browser

Pete Brown - 18 March 2009

One of the long-anticipated new features of Silverlight is the ability to take applications out of browser, online or offline.

in Silverlight 3, it couldn’t be easier. Simply crack open the AppManifest.xml and uncomment the markup that allows for taking your app offline.

<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Deployment.Parts />
  <Deployment.ApplicationIdentity>
    <ApplicationIdentity ShortName="SilverlightC64" 
                         Title="Pete's Silverlight C64 Emulator">
      <ApplicationIdentity.Blurb>
        Commodore 64 Emulator in Silverlight 3
      </ApplicationIdentity.Blurb>


    </ApplicationIdentity>
  </Deployment.ApplicationIdentity>
</Deployment>

You’ll probably also want to add some icons. Here’s how.

In the AppManifest.xml, add an ApplicationIdentity.Icons section with the various icon sizes for the different operating systems. The icons should be png files to support transparency and cross-platform.

<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Deployment.Parts />
  <Deployment.ApplicationIdentity>
    <ApplicationIdentity ShortName="SilverlightC64" 
                         Title="Pete's Silverlight C64 Emulator">
      <ApplicationIdentity.Blurb>
        Commodore 64 Emulator in Silverlight 3
      </ApplicationIdentity.Blurb>
      
      <!-- Icons -->
      <ApplicationIdentity.Icons>
        <Icon Size="16x16">AppIcon016.png</Icon>
        <Icon Size="32x32">AppIcon032.png</Icon>
        <Icon Size="64x64">AppIcon064.png</Icon>
        <Icon Size="128x128">AppIcon128.png</Icon>
      </ApplicationIdentity.Icons>
      
    </ApplicationIdentity>
  </Deployment.ApplicationIdentity>
</Deployment>

Next, go and add those pngs to your project. Be sure to set them as Content, not resource.

image

Once you do that, build and run your application.

image

Then right-click on the Silverlight surface and you’ll get an option to take it offline:

image

You’ll then be prompted for install. Note that your custom icon shows up in this dialog. Also note that my app’s title is a bit long. You’ll want to make sure your title fits in the text in this dialog.

image

If you selected the options to create a start menu and/or desktop icon, you’ll now see it in those places. Note again the use of the icon.

image

image

The app itself opens in a standard window. Currently there’s no way to control the size or location of this window, or otherwise play with the chrome. I hope that Microsoft adds those options later. Note also that the object tag paramters you had on the web page are not transferred over to the offline app, so you need to make sure the silverlight app in the .xap can stand on its own.

As expected, the app icons show up in the window chrome and on the taskbar.

image

 image

To remove the application, run your app and right-click to select the option to remove it

image

To keep things simple, there is no separate uninstall program or control panel item.

That’s it for the basics. We’ll get into the code to check online/offline status and allowing for an application-level button to take the app offline in a future post.

   
posted by Pete Brown on Wednesday, March 18, 2009
filed under:    

2 comments for “Silverlight 3 – Taking Silverlight Out of the Browser”

  1. nmreddysays:
    thank you..
    I am curious to put my Out Of Browser application in Notification Area (Tray Icon). Especially when user minimizes my Out of Browser applications it should keep one ICON in Notification Area. Once he gets some alert or To-Do operation, it will show one “Notification Window” (like Outlook New Mail Notification Window). Is it possible to these kind of operations in Silverlight
  2. Pete Brownsays:
    What you're asking for is two part, but for version 3 at least, the answer to both is "not yet"

    1. Can you have your OOB app minimize to the system tray? Answer is that this is not currently available in Silverlight 3, but is being considered for future versions.

    2. Can your app display toast (the pop up notifications). Not currently, but also being considered for future versions of Silverlight.

    Whatever solution the Silverlight team picks would need to look and work correctly across all supported platforms.

    For now, if you want to do those things, you can with WPF. The only real restriction there is limiting yourself to Windows machines.

    Pete

Comment on this Post

Remember me

5 trackbacks for “Silverlight 3 – Taking Silverlight Out of the Browser”

  1. DotNetShoutoutsays:
    Thank you for submitting this cool story - Trackback from DotNetShoutout
  2. VBandi's blogsays:
    In early May, I gave a talk about the new features in Silverlight 3. As I’ve started to gather material