Silverlight 2.0 for WPF developers

The last one-and-a-half to two years I have been developing WPF applications. A few weeks ago I decided to go and start playing around with Silverlight 2.0. After all on the surface it looks almost the same as WPF. And this also the pitfall because as a WPF developer it looks so much like WPF you tend to think it is WPF.
Fortunately Microsoft guides you through the differences on MSDN: Silverlight WPF Compatibility. This list most of the differences. Some topics you take for granted like the lack of 3D graphics in Silverlight. Some things that are annoying (at least I ran into them) but yet workable like: no ResourceDictionaries, no DynamicResources, no UI to UI element binding, or no binding to XML.
But it lists also more irritating differences:
- No possibility for custom routed events, no preview events and simply fewer events (including the absence of the drag drop events).
- No CollectionView or CollectionViewSource.
- No Triggers. Silverlight uses a VisualStateManager which is driven from code. This is something completely new if you’re used to developing WPF stuff where you could simply use triggers to use a different appearance for different states. On the internet you can find what is ‘wrong‘ with the VisualStateManager from a WPF perspective. I found a blogpost of John Gossman describing how these two models (of WPF and of Silverlight) can be (and seem to be) merged by Microsoft in the future.
- No CoerceVallueCallback for dependency properties.
But the real reason for this post (besides that I didn’t find the MSDN page directly) is that I ran into some undocumented differences that got me puzzled for a while:
- Some controls such as ListBox and ListBoxItem do not raise the LeftMouseButtonDown event although they do define it.
- ListBox has no ItemContainerGenerator which can be useful to translate a ListBoxItem to a data object.
- The Visibility enumeration only has the values Collapsed and Visible (looks like a boolean to me!). The missing Hidden member can of course be solved by setting the opacity to 0.
- No Adorners.
I hope it will help some of you if you decide to go developing a Silverlight application as a WPF developer. Remember the primary target for Silverlight is to develop Rich Internet Applications and give the users a Rich Internet Experience and to do this it is a very powerful framework. The possibility to develop a full-fledged LOB application has lesser priority and as such requires a little more effort to realize.
I have not yet touched all the different areas (for example not a single service call is made) of Silverlight so if you think I missed an important difference here please comment.