I have spent the past couple of days checking out Silverlight 2.0. I have much to say about my findings thus far, but in general, I am both shocked and pleasantly surprised. Since Silverlight 2.0 is an alpha, there is no point in being too critical of it just yet. According to Scott Guthrie the next RTM release, called Silverlight 2.0, will be much more feature-rich than the current alpha.
I expected Silverlight 2.0 to be an enormous, complex, sophisticated platform rivaling the technical splendor known as WPF. I mean, it used to be called WPF/E , right? Boy was I wrong! I just kept saying to myself, “I can’t believe Silverlight does not have that either!” At first, it felt like I was trying to play a piano that had all of its white keys removed, and I could only use the black keys to make music.
Here is a brief list of some things in WPF that we know and love but are currently missing from SL 2.0:
- Standard controls; like Button, TextBox, ListBox, CheckBox, etc.
- Layout panels
- Data binding
- Routed events
- A vast number of events on elements seen in WPF
- A resource system based on merged resource dictionaries
- Visual and logical trees (no programmatic construct represents them, at least)
- Did I mention that there’s no Button???
Once I got past all those missing necessities, I found that what does currently exist is actually very cool. If Microsoft delivers all that Guthrie promised in his blog post (which does not include everything in the list I provided above), SL 2.0 should be an excellent platform.
I must admit, though, I really miss routed events. Now that I think about events as tunneling and bubbling, working with normal CLR events really stinks. It feels so primitive. However, I might have found something that indicates Microsoft intends on adding routed events into SL 2.0 (even though Guthrie did not mention this in his post). The EventTrigger class exposes a RoutedEvent property, just like in WPF. It is possible that they named SL’s EventTrigger’s property “RoutedEvent” to ensure that the Silverlight XAML compiles in WPF, but perhaps they actually intend on implementing routed events in the future. Think about it, what sense would it make to have a property called RoutedEvent if routed events do not exist in SL?
I tried watching some of the video tutorials on Silverlight.net that go over the basics, but most of them were so dumbed-down that I felt like I was in a Special Ed class. I have found the Quick Start tutorials to be very helpful and insightful for a newbie, such as myself.
For my first SL 2.0 project I decided to build a very simple ListBox control. Please keep in mind that this is the first Silverlight project I have ever written, so don’t expect anything too cool. After creating this ListBox I found out that the Silverlight SDK comes with the source code for a ListBox control. I checked out the SDK control, and it is definitely better than mine is, but at least mine allows you to navigate the items with your keyboard. Ahha! Take that, Microsoft!! ;)
Below is a screenshot of my AgListBox control in action, with some text above it explaining which item is selected (in case you couldn’t already tell…):
Here is My First Silverlight Project. Be sure to change the file extension from .DOC to .ZIP and then decompress the file. If you need to install the Silverlight runtime and tools, check out the list of requirements and links here.