Welcome to irritatedVowel.com Sign in | Help

POKE 53280,0: Pete Brown's Blog

Silverlight, WPF, Windows Client Development, Woodworking, .NET Programming, CNC, Nature, and other topics.

Subscribe

Subscribe to my feed
Add to Technorati Favorites

My Book

Order my upcoming book, Silverlight in Action, covering Silverlight 4, ViewModel/MVVM, WCF RIA Services, MEF and more

About Pete Brown

Pete Brown is a Microsoft Developer Division Community Program Manager, focusing on Windows Client Development as well as a former Microsoft Silverlight MVP and INETA Speaker. Pete writes on a number of topics including Silverlight, WPF, .NET, woodworking and working as a consultant in the DC area. read more

Community Events


who's online

AddThis Social Bookmark Button

Silverlight 3 – Taking Silverlight Out of the Browser

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.

  Add to Technorati Favorites
Posted: Wednesday, March 18, 2009 2:45 PM by Pete.Brown
Filed under: ,

Comments

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout
# March 18, 2009 6:09 PM

Silverlight Playground said:

Links to Silverlight 3.0 resources
# March 19, 2009 4:31 AM

Rob Zelt - Lighting Up The Web said:

# March 22, 2009 2:40 PM

Frank La Vigne said:

# April 29, 2009 3:51 PM

VBandi's blog said:

In early May, I gave a talk about the new features in Silverlight 3. As I’ve started to gather material
# May 3, 2009 6:42 AM

nmreddy said:

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
# June 28, 2009 3:12 PM

Pete.Brown said:

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

# June 28, 2009 3:44 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Enter the text you see in the image:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS