Can I use Silverlight to build cross-platform desktop widgets?
Silverlight Vs WPF
First of all, WPF is not exactly Silverlight. They essentially require different run times. Silverlight Runtime is a subset of .NET, and needs to be installed by the client, to view your SL applications over a browser. Presently SL runtime is available for Windows and Mac. Moonlight is still not full fledged, and is evolving, for Linux.
WPF, on the other hand, is purely on top of .NET runtime, and is available only for Windows.
You can use XAML to develop user experiences in Silverlight and WPF, and as long as you stick to the Silverlight subset, you can compile your XAML in WPF as well.
Desktop Widgets
Now, your thought about building cross platform 'desktop' widgets - Do you want to host a Silverlight application in a desktop window? Silverlight 3.0 provides support for hosting silverlight controls out of the browser.
Otherwise, see my blog entry on hosting Silverlight using a browser shell. http://amazedsaint.blogspot.com/2008/12/thinking-outside-silverlight-sandbox.html.
This post is revolved around
- Hosting the HTML Page with Silverlight in a Winforms/Webkit desktop application using a web browser control, and communicate to and fro using HTML DOM
- Embedding a light weight web server with in the Host application, and handle requests to perform such operations
But remember - it is not WPF. Hope this clarifies.
In Silverlight 2.0, you won't have any such luck.
In Silverlight 3.0 (currently in beta), however, support has been added for Out of Browser Capabilities, which means you can download and run Silverlight apps from your desktop.
The Silverlight platform in general is cross-platform, so external (desktop) aplications in Silverlight 3.0 will be exactly the same.
Quoted from the What’s New in Silverlight 3 Beta? section of the release page:
Out of Browser Capabilities. The new out of browser experience in Silverlight 3 enables users to place their favorite Silverlight applications directly onto their PC and Mac, with links on the desktop and start menu—all without the need to download an additional runtime or browser plug-in. Further, the new experience enables Silverlight applications to work whether the computer is connected to the Internet or not—a radical improvement to the traditional Web experience. Features include:
- Life outside the browser. Silverlight applications can now be installed to and run from the desktop as lightweight web companions. Thus, users can take their favorite Web applications with them, regardless of whether they are connected to the Internet or not.
- Desktop shortcuts and start menu support. Silverlight applications can be stored on any PC or Mac computer’s desktop with links in the start menu and applications folder, and so are available with one-click access.
- Safe and secure. Leveraging the security features of the .NET Framework, Silverlight applications run inside a secure sandbox with persistent isolated storage. These applications have most of the same security restrictions as traditional web apps and so can be trusted without security warnings or prompts, minimizing user interruptions.
- Smooth installation. Because Silverlight applications are stored in a local cache and do not require extra privileges to run, the installation process is quick and efficient.
- Auto-update. Upon launch, Silverlight applications can check for new versions on the server, and automatically update if one is found.
- Internet connectivity detection. Silverlight applications can now detect whether they have Internet connectivity and can react intelligently including caching a users’ data until their connection is restored.