Wednesday, May 09, 2007

building Silverlight apps with .Net

One of the better breakout sessions I've seen from MIX so far about Silverlight is the 2-part "Building Silverlight Applications with .NET" presented by Jamie Cool and Nick Kramer. This presentation covers all of the Silverlight basics- like what it is, where it runs, and how it integrates with .NET- and provides a good primer on XAML. But since the presentation is over 2 hours long, I've prepared a quick summary of the highlights for you here so you can get the knowledge even if you don't have 2 hours to spare (and who does these days).

Silverlight Basics
Since this presentation addresses .NET and Silverlight, you can already assume we are talking about Silverlight 1.1 (due towards the end of this year/early 2008, though officially they're "not prepared to comment on the release at this time"). Version 1.0 of Silverlight, which ships this summer, will include most of the core Silverlight elements but will not have .NET integration, XAML extensibility, or any built-in controls. The following slide from the presentation makes clear what will be in 1.0 and what will be in 1.1.

Silverlight 1.1 will implement a subset of the "standard" .NET framework as we know it today. That means the programming model for Silverlight development doesn't change, but there may be some features in "normal" .NET that won't be available in Silverlight. Jamie made it clear they haven't completely determined which features from the 50MB .NET framework will be ported to the lightweight Silverlight version, but their goal is to deliver as much functionality as developers need without bloating the download and ruining the user experience.

It's important to remember that all Silverlight applications will literally run in the browser. This is not like ASP.NET with .NET that runs on the server and sends HTML back to the browser. Silverlight apps are compiled and downloaded when a visitor visits your site and then they run completely on the client machine (which means there is no server session or ViewState to deal with!). That also means your Silverlight apps will be able to respond to mouse events in .NET code, something Windows developers are used to but something web developers will have to get used to.

Silverlight will run in a browser sandbox, which means that it will not have access to the local file system (like ActiveX). This is primarily done to keep Silverlight as secure as possible, but there are some things being done to add "special" client features to the new framework. Supposedly, Silverlight will have "isolated storage" on the client for some amount of local file saving (limited by a quota and secured by an obfuscated path) and support for client-based file upload. The Silverlight Team is also working on enabling some cross-domain access from Silverlight, though they acknowledge it is a difficult feature to enable without jeopardizing security.

Silverlight Ingredients
Silverlight applications are composed of a few basic ingredients, including JavaScript, XAML, HTML, and some miscellaneous assemblies. To deploy a Silverlight application, all you have to do is upload your files to a server and point your browser to the URL of your HTML (or ASPX) file. The rest of the magic happens on the client, including automatic detection of the Silverlight plug-in and automatic help installing the plug-in if it's missing (this functionality is built-in to the Silverlight JavaScript files). Silverlight plug-ins are also installed with an auto-updater, so as Microsoft improves the plug-in you can count on a majority of users quickly adopting the improved version.


Silverlight 1.1 alpha vs. 1.1 release
It is clear that the first release of Silverlight is just a "placeholder" for the 1.1 release. That means a lot of attention is going to be on the 1.1 alpha released last week. To help us understand what's in the alpha and what we can expect at release, Jamie and Nick provide a full 5 slide overview of the differences in their presentation that I have recompiled in HTML for your viewing pleasure.

The "1.1 alpha" column lists all of the features in the currently available Silverlight 1.1 version and the "1.1 thinking" column represents what the Team is currently planning for the release. The loose "thinking" term is used to make it clear that there is still room and time to negotiate what does (and doesn't) make the 1.1 release. The WPF column is included to show how "WPF/e" compares to its big brother on the desktop.

Controls


1.1 alpha

1.1 thinking

WPF

Button

Sample

Yes

Yes

TextBox (edit)

No

Yes

Yes

ScollBar

Sample

Yes

Yes

Slider

Sample

Yes

Yes

ListBox

Sample

Yes

Yes

CheckBox

No

Yes

Yes

RadioButton

No

Yes

Yes

Combobox

No

Yes

Yes

Treeview

No

No

Yes

Accordian

No

No

3rd Party

DataGrid

No

No

3rd Party

UserControl

Yes

Yes

Yes

Layout

Canvas

Yes

Yes

Yes

Grid (table)

No

Yes

Yes

StackPanel

No

Yes

Yes

ViewBox

No

Yes

Yes

Other

Mouse Events

Partial

Yes

Yes

Keyboard Events

Partial

Yes

Yes

<.Resources>

Partial

Yes

Yes

Data binding

No

Yes

Yes

Styling

No

Yes

Yes

3D

No

No

Yes

Hardware Acceleration

No

No

Yes

Out-of-browser

No

No

Yes

Off-line

No

No

Yes

Cross-platform

Yes

Yes

No


Silverlight Gotchas
There are a few gotchas in the current Silverlight 1.1 plans. At present, each Silverlight control that you add to the page is isolated to its own domain. That means if you load multiple Silverlight controls at different places on your page, they will not be able to communicate with each other. This is an alpha issue that will hopefully be addressed before the release.

Also, System.Data, one of the most common .NET framework namespaces in any .NET project, is not currently planned for inclusion in Silverlight. The Silverlight team is not sure that the namespace is necessary (that's how tight space is in .NET "light"), so be sure to let your voice be heard if you want DataSets and DataTables in the Silverlight 1.1 release (or forever hold your peace...until 1.5).

Wrapping it up
Clearly this was an information packed session. I've only managed to scrape the surface of what was covered so I highly encourage you to watch the original broadcast online if you want to know more. I've also prepared a small gallery of screenshots from the presentation that includes most of their slides and a handful of application screens. (With Silverlight based videos we can finally make screen captures from video files! No more pseudo video in the browser.)

Hopefully you've learned more about Silverlight and understand more clearly how the latest releases play into its overall plan. Enjoy the screenshots and watch for more Silverlight updates in the future.

4 comments:

Anonymous said...

What about document features like Flowdocument in Silverlight?

Todd Anglin said...

What about them? I'm not sure I understand what you're asking. If you would to provide some more details I'll be happy to provide a better response.

Thanks~
Todd

Anonymous said...

Will FlowDocument be supported in the final release of Silverlight or at least a lightweight control with the most important features to create something like a rich text editor?

Todd Anglin said...

Assuming you are the same anonymous person, thanks for the extra clarification. Telerik's plans for its first Silverlight RadControls offering are still being finalized, so I'm not entirely sure what will make the initial release. This is a great suggestion, though, so I will make sure the teams consider a rich text editor.

Thanks~
Todd