WPF 4 vs Silverlight 4
November 30, 2011 at 8:22 am Leave a comment
During last four years I was developing a Windows applications using WPF. From time to time, various people were asking me: “what the difference between a WPF and SL”? Well, until now I was never using SL (lucky me), but based on what I heard I was answered: “SL is a subset of WPF”.
Generally speaking, I was right – it is a subset. BUT I was never thinking that subset is so small… I developing using SL4 only a month, but I missing so much things from WPF… The strange thing is, the workarounds for most missing features I met until now in SL is existing – you can find it on Internet or implement yourself. So I really don’t get the reason why they are not implemented from the beginning.
So, I decided to build a list of missing features in SL4, compared to WPF. Next time I will be asked what the difference between them – I will be able to answer more specific. The post will be updated as I will discover something new. You welcome to write in comments what you are missing.
OK, lets start. The missing features in SL4, compared to WPF are:
- No style selectors
- No visuals
- No adorners
- Reflection cannot be used on private members
- DataContractSerializer requires “DataContract” and “DataMember” attributes declared explicitly
- No Binary formatter
- Visability enum has only “Collapsed” and “Visible” states (no hidden)
- No Visual brush (of cause, since no visuals)
- No MiltiBinding
- No FrameworkMetadata
- No SerializableAttribute
- Bugs (under the hood, implementations of libraries in WPF and SL are completely different. Things that work perfectly OK on WPF refuse to work normally on SL. For example, today I tried to call ItemContainerGenerator.ContainerFromItem method on ComboBox. Instead of returning expected container, it always returns null…)
- MeasureOverride and ArrangeOverride methods of panels are sealed
- UUrrrr… bugs are all around. Everything I touching is not working… I spent 4 hours, trying to make a ComboBox width to be as the maximal width of its children. Eventually I gave up, due to bug in ItemsGenerator inside ComboBox: calling to ContainerFromItem method returns null instead of container. So there is no way to know the size of rendered children… After that, I said: OK, lets do another task. I trying to implement kind of adorner for my textbox (there is no adorners in SL – right?). So I took a regular panel, to serve as a layer above textbox. Next thing I was need is to bind size of panel to actual size of textbox. Impossible, since there is a bug with ActualWidth (known issue)…
- There is no Tasks in SL4 (documentation says it will be supported in SL5, though)
- DependencyPropertyDescriptor is not supported
- Cannot use bindings inside styles (but workaround exist, for more information read here)
- …To be continued
Entry filed under: WPF. Tags: Silverlight, WPF.
Trackback this post | Subscribe to the comments via RSS Feed