As it is said here:
http://houseofbilz.com/archives/2010/12/29/cross-training-in-silverlight-flexmvvm-vs-presentation-model/
\"If you do a Google search today fo
What prevents Silverlight MVVM to be implemented like Flex ?
in .net silverlight/wpf everything should transparent. Binding is notification mechanism so, it should act "at least" like event base system.
If yes why does Silverlight do things more complicated what's the advantages then ?
for me, it is about mindset, if i know it is an event base system, then i should carefully use it. do not over use it, etc.
cases: Binding converter, easily implemented in flex, not in silverlight.
in flex: text="{getColor(pm.customerName)}"
yes it is amazing simple, but the question is are you sure your PM will be released correctly by garbage collection, because it is an event base system, who responsible to observe the change? getColor
method? or text
property? or both? really hard to know that.
in silverlight: text="{Binding CustmerName, Converter={StaticResources nameToColorConverter}}"
i don't need to ask who is responsible to observe, because colorConverter is only a converter supported by binding. i don't need to worry about memory leak.
so, for me its all about the mindset.
There are two things, really that make it more complicated:
One thing you can do in Silverlight is use the "Property Weaver". It will do something similar to the [Binding]
tag in Flex as it will automatically take public getter/setters and re-write them with the INPC pattern.
As for commands, wrapping methods in DelegateCommand
s proves to be a lot of plumbing. There are several approaches to this. I like a convention-based approach, where you declare a public method named Execute_Something
and the command Something
is automatically created for you to bind to. Here and Here.
Finally, binding in Flex is expression-based where as binding in Silverlight is purely declarative. I have some ideas for when we get C# v.Next and we might be able to do expression-based binding pretty easily.