Porting WPF to Silverlight - 4th of a series...

Well, before I get to my adventures with slwsdl.exe and making web service calls, I'd like to discuss controls in Silverlight 1.1.  The good news is that (unlike Silverlight 1.0) there is indeed a control model in Silverlight 1.1 - you can find the supported control set via the Orcas Object Browser under agclr's System.Windows.Controls namespace.

agclr's System.Windows.Controls namespace

...by the way, I'm guessing that the use of "ag" as a prefix throughout Silverlight refers to "Argentum", which is the Latin name for silver (abbrevatiated as "Ag" in the periodic table of the elements)...

While it's nice to see old friends like Canvas, Image, and TextBlock in the mix, there are a few useful controls missing.  Let me qualify what I mean by "a few" here.  If you're a .NET developer looking to build greenfield Silverlight apps, you're probably quite pleased with the capability to write and debug managed code that runs across browsers and platforms - you'd probably like a button or a text box, but can make do with what's there.

However, if you're a WPF developer expecting to write XBAPs for Safari, you've just found yourself starting straight into the rewrite abyss.  No Button, TextBox, ListBox, StackPanel, Grid, etc. - yikes!  Fortunately, you can escape that pit of despair with a little ingenuity (this is an Alpha build, after all - you should expect a few bumps along the road to RTM.)

First, there's the SilverlightControlsStaterKit sample in the SDK - it provides a Button, ListBox, ScrollBar, and Slider for starters.

Silverlight SDK's Silverlight.Samples.Controls namespace

Also, Dave Relyea posted a sample which contains several more controls (including Border, Grid, Label, StackPanel, Button, and TextBox.)  You can find a link to the source from this blog posting.

agLayoutDemo's agLayoutDemo.Controls namespace

That's a pretty reasonable control palette (and frankly, was much better than I expected to find after getting my expectations diminished by what I had been reading and hearing.)

While I don't expect to have the full stylization or templatization capabilities of WPF, I do now have a similar programming model (and thus much better prospects for code reuse.)

And so, I'll now undertake the adaptation of my XBAP to Silverlight 1.1 using these controls.  I'll certainly give the Border, Grid, ListBox, TextBox, StackPanel, and (of course) Button a good workout.

My next post will discuss the capabilities of this approach and limits I find - after that, I should be able to come back around to web service calls (hopefully within the next few days.)