Learning Silverlight: Day Two

Today I finished reading through Christian Wenz’s Essential Silverlight Up-To-Date. According to Amazon, the book ships tomorrow — I was able to read it though my subscription to Safari Books Online. From what I can get out of browsing the Amazon site, it is the first Silverlight 2 book to come out, and precedes the others by about two months. It is, essentially, the only game in town for those planning to learn Silverlight 2 from a book.

It is a bit of a mixed bag, due not least to the difficulties involved in trying to write a book about a technology that is still in flux. Breaking changes are expected during the transition from the beta 1 to the beta 2 of Silverlight 2, and most book authors in this sub-genre of a sub-genre have adopted the better part of valor. So thanks are due to Mr. Wenz for accepting such a difficult task and finding a way to meet his publisher’s deadline.

That said, while the book offers a good overview of the Silverlight 2 technology, in doesn’t go into any particular depth. The labs are difficult to follow, at times, because some of the things he writes about do not appear in the Silverlight 2 beta 1, such as a project template for user controls. Since his walkthroughs require the use of a user control, I was obliged to google the right way to create one, just so I could finish the book.

Frustratingly, the chapter on Programming Silverlight with .NET is extremely brief, despite the fact that this is perhaps the most interesting new feature of Silverlight 2. Or perhaps this is merely an artifact of the way I read it, and the physical copy that will be placed on bookstore shelves will have more content. At least I hope this is the case.

I was finally able to get a user control into my XAML page by following the official Silverlight 2 hands-on labs, found here. Microsoft is not known for being good at documenting their bleeding edge technology, but these labs are actually quite excellent, and may currently be the best resource for learning Silverlight 2. I’ll know more tomorrow, as I plan to work my way through all the tutorials and labs on the official Silverlight site.

The trick with adding a user control to a XAML page, it turns out, is that a namespace declaration to the containing project has to be added to the page. The page, for whatever reason, is not automatically aware of the assembly it is in. Once the namespace is declared, however, Intellisense takes over and makes adding your user controls — HelloWorld.xaml, in this case — quite easy.