My first experience with Silverlight 2.0

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
  • Templates
  • Styles
  • Commands
  • 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…):

AgListBox in action

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.

About these ads

11 Responses to My first experience with Silverlight 2.0

  1. Peter Zajíc says:

    I think, Silverlight 2.0 will be heaven on earth. Creating web experience, using the same skills we gained since we felt in love with WPF is superb. Personally I hate webs, but this technology can change it :-)

  2. I see we are spreading our wings!

  3. Oran says:

    I have a conspiracy theory I’d like your thoughts on. Assume Silverlight nails 80% of the items in your list. Then they flip the bit that lets it run off-line, out-of-browser. Wouldn’t that make the average developer seriously think twice about doing any new development in “WPF/Classic”? I hope I’m wrong, but I can see it happening.

  4. Pete Brown says:

    The lack of controls can be a real pain. When we wrote our 1.1 carbon calc app after Mix07, building a drop-down list box was probably the most time-consuming thing I did. Microsoft will fill that gap, though, and lots of third-parties are jumping in as well. For real cross-platform business applications, 2.0 looks exciting.

    Oran: There will always be some of that, just as many web apps written today would have been better and quicker to develop as windows/wpf applications. However, Silverlight won’t have full access to the .NET framework, many integration points WPF has, 3d controls etc. What the converging of the two does do is make it MUCH easier to switch from one to the other during development should you hit a requirement that dictates you use the other platform. Very cool, IMHO. I actually expect Silverlight excitement to help drive UP adoption of WPF.

    Pete

  5. Josh Smith says:

    Oran,

    I wouldn’t be surprised if your theory holds some water. Perhaps what Pete says about SL driving up adoption of WPF, which is always going to be more feature-rich due to the fact that it does not run in a browser’s security sandbox, is true as well.

    Pete,

    I agree that once SL 2.0+ is around, there will be no good reason to postpone at least giving SL a test drive. I’ve never been interested in web dev before, but with something like SL at our disposal, even a hardened desktop fanatic like myself is tempted to get involved.

    Thanks,
    Josh

  6. MSteam says:

    We have developed some projects with Silverlight 1.1 (you can see them here: http://demo.themsteam.com/videopuzzle/ ) and certainly looking forward to using 2.0 release for our next project.
    It’s a very interesting technology for us as we have specialized in .net development but had to use Flash for client-side.

  7. Nick says:

    Hi Josh,
    I am having problem running your project. When I run it, it prompts me to install Silverlight 1.0, even though I already have Silverlight 1.1 alpha installed. Since you said that it is Silverlight 2.0 (I assume 1.1 alpha) that you were using I think it will not help if I really install Silverlight 1.0.

  8. Josh Smith says:

    Nick,

    I don’t know why it’s prompting you to install SL 1.0. The reason I refer to 1.1 as 2.0 is because ScottGu’s blog says that MSFT has rebranded SL1.1 to sound more significant. http://weblogs.asp.net/scottgu/archive/2007/11/29/net-web-product-roadmap-asp-net-silverlight-iis7.aspx

    Thanks,
    Josh

  9. Nick says:

    Sorry, problem resolved

  10. Rocky Moore says:

    Actuallky, I think the rebranding of 2.0 is suppose to be when the next version (suppose to be beta) comes out. It is confusing to here SL 2.0, when the is no version of that label out yet. When I first started reading your post, I thought you have got your hands on an alpha of 2.0, not the 1.1 alpha until you started mentioning all the missing parts.

    Even with the missing parts, Silverlight 1.1 alpha still has a great deal of of power, one of the most important is a subset of .NET running client side. V2.0 though, will really bring SL into the big time for sure!

  11. Josh Smith says:

    Rocky,

    My bad. I was confused, since ScottGu’s blog mentioned that SL1.1 was rebranded to SL2.0. D’oh!

    Thanks,
    Josh

Follow

Get every new post delivered to your Inbox.

Join 274 other followers

%d bloggers like this: