views:

89

answers:

1

Can anyone provide a short example of how to execute an event within the mvvm pattern for silverlight? In reading I have seen references to where silverlight does not support commanding? If that is the case how then what is the most common practice to initate methods in the mvvm pattern? Is a third party framework need or can this be accomplished using routed events? A simple example would be great... say a button wihtin the xaml and then within a viewmodel class the method to open an alert window of change the text of a textblock? I'd appreciate any insight as to what the most common approach is for initiating an event( mouse click events etc) and how these methods could be called.

thanks in advance

A: 

Though there isn't an implementation on Silverlight, the ICommand interface is present in the framework. You should take a look at the DelegateCommand class in Prism.

Anero
Thanks Anero, I've also been looking at MVVM Light which offes a similar solution through relay commands. I was curious as to if there was another solution aside from invoking another library but at this time this does not seem to be the case. I've worked with the delegate command class and while it gets the job done the level to implement is "a little heavy". Not complaining just looking to see if there was a more efficent manner that I was unaware of.
randyc