B_W
B_W

Reputation: 21

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?

Upvotes: 2

Views: 265

Answers (2)

Luke Puplett
Luke Puplett

Reputation: 45115

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"

Upvotes: 0

Matt Casto
Matt Casto

Reputation: 2170

You can use the EventToCommand behavior to still do commanding with buttons in Silverlight 3.

Upvotes: 1

Related Questions