Silverlight 1.1: What Have You Learned Dorothy?

Well, I – I think that …- if I ever go looking for my heart's desire again, I won't look any further than my own back yard. Because if it isn't there, I never really lost it to begin with! Is that right?

I have three presentations coming up at Tech Ed, and one is on Silverlight 1.1, so I gave myself special dispensation to begin creating "How Do I?" videos on 1.1…

It is actually a great deal of fun, mostly because there is the instant realization that for now (given that the soon-to-be-released toolkit-items are not yet available, we're still just dealing with XAML and code, but the code, of course, is C#, which (for me) is ever so much more satisfying than working in Javascript (both because I know it better, and because it is type safe and fully object oriented.

I admit, I did find getting started a bit intimidating, but it turns out to be pretty simple, especially if you read the label and follow the directions; that is, if you just click on Silverlight Project in Visual Studio 2008. What you start out with is a nice XAML file that is unencumbered by a sample (no click button!) but which does have a very simple code-behind file, and an HTML file with a Javascript code-behind file. As you might expect, the HTML file creates the Silverlight control inside a div and the HTML code behind file calls CreateObjectEx, not unlike what we did in 1.0. 

What's new, of course, is that the code behind for Page (not Scene).XAML is a C# file, and in there the default is to have a Page_Loaded method but no constructor, but we are free to write our own constructor, and we get wonderful support from Intellisense.


My first venture was to reproduce an application that I had already written in 1.0, exploring brushes, and fills and the code that goes with them, and comparing that to 1.0. It was pretty interesting but held few surprises. 

One of the features that was not in 1.0 but is in 1.1 (as well as in WPF) is that every XAML object is isomorphic to a CLR object; that is, anything you can create in XAML you can create in code. That was too cool not to play with, and that became my second video on 1.1

In 1.0 if you match up HTML and Silverlight and you want to convey information from an HTML control (e.g., a button or a text box) to that Silverlight control, the HTML object must send the information into the Silverlight control. In my third video, I explore how the Silverlight control can make a reference to the HTML objects and then "reach out" and grab what it needs, including creating event handlers for the HTML objects (very cool).

That lead me to the idea of creating a custom control in Silverlight 1.1 and that in turn lead me to a dilemma.  What custom control could I possibly create that didn't run the risk of being absurdly obsolete by the time we release all the nifty toolkits that are on the way.  Which lead me to thinking about why we create custom controls in the first place, and one good reason is if we need a bit of UI that has custom behavior or properties, that we want to use again and again and that we want factored out and cleanly encapsulated.  What could be more fun than to take the opportunity to factor out and encapsulate a bit of UI from Conway's famous cellular automata Life.

Those four videos will be coming out soon (and I'll provide more information about them when they are posted) but I wanted to keep you up to date. The short story is this: I will have no trouble going back to creating applications in 1.0 (rather than 1.1) because they are so similar, but, once 1.1 controls hit, then it will be harder to tear me away.

In the meantime, enjoy the new videos once they are posted and let me know about your experiences moving back and forth between 1.0 and 1.1.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in z Silverlight Archives and tagged , . Bookmark the permalink.