Silverlight is designed primarily for hosting in Web pages. However, there are several alternative hosting options that enable Silverlight to run outside the browser or in other hosting environments.
Most alternative hosting options are beyond the scope of this Silverlight document discussion. However, this topic summarizes these options and provides links to additional information and sample code that are available. In particular, the Silverlight alternative Hosting (Silverlight alternative hosting) page on the MSDN Code Gallery (MSDN codebase) provides additional documentation and code examples for some advanced hosting options.
Description
Silverlight has the same security sandbox restrictions, regardless of whether the hosting environment or Web browser exists. However, the hosting environment can provide full access to the local computer, effectively bypassing Silverlight security.
If the browser or network connection does not exist, the hosting environment may need to provide an alternative function based on your requirements.
Using Silverlight outside of the browser
Silverlight provides basic browser support for your Web-hosted, Silverlight-based applications on Windows and Macintosh computers. This is the easiest way to use Silverlight outside of a Web browser, but it requires the user to install the application from the host Web page.
For richer offline support, including full access to the local computer, consider using Windows presentation Foundation (WPF). WPF provides a superset of the Silverlight feature and enables you to convert a Silverlight-based application to a full-featured Windows application with minimal code modification.
Using Silverlight in Browser Controls
Using embedded Web Browser Controls is the easiest way to add Silverlight to an application created with another technology. In this case, your application hosts a browser control that displays a Web page that hosts your Silverlight-based application.
Depending on your needs, you can hide the boundaries between the host layers and create a seamless user interface. In order to communicate between your host application and the Silverlight code, you can use the HTML DOM.
For information about how to access the HTML DOM from Silverlight, see the interaction between HTML bridge:html and managed code. To access the DOM from your host application, consult the documentation for the selected browser control. The following table indicates some of the common browser controls.
Windows Forms WebBrowser Controls.
WPF WebBrowser Control.
Win32 WebBrowser Control.
MSHTML components.
Macintosh OS X WebKit framework.
Using the Silverlight user interface in other plug-ins or applications
Silverlight provides an unmanaged interface named Isilverlightviewer, through which you can retrieve a bitmap rendering of the Silverlight-based user interface (UI). You can use this feature to combine the Silverlight user interface elements with the user interface of other applications.