MVVM Light and SL3 Commanding
I am familar with MVVM. Actually been doing most of my learning in SL4. However, with a recent need, I have to use SL3. I am attempting to use MVVM Light v3 with SL3 and utilize commanding. The problem is that in 开发者_如何学编程SL3 there is no Command attribute for buttons. I managed to find an old article (http://blog.galasoft.ch/archive/2009/09/26/using-relaycommands-in-silverlight-and-wpf.aspx), but I am having trouble figuring out the ButtonBaseExtensions.Command. It appears it is no longer available in GalaSoft.MvvmLight even though the namespace GalaSoft.MvvmLight.Command is.
So the question is how can I use MVVM Light v3 with SL3 and leverage commanding? Do I use MVVM Light v2? Can v2 and v3 coexist on the same machine?
You can use the EventToCommand behavior to still do commanding with buttons in Silverlight 3.
You need these lines of code to make the above XAML work:
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7"
精彩评论