Silverlight and MV (VM) Pattern - No Code-Behind - Is It Possible?
I am working on Silverlight 3.0 and am currently using the code in my views. I would like to implement the MV (VM) pattern in my project as the project grows. I have seen several WPF projects where the code-behind has NO CODE other than the InitializeComponent method, which I believe is the correct way and just looks clean. Is this possible in Silverlight 3.0, i.e. without code?
Can anyone point me to some good tutorials / articles on MV (VM) Silverlight (3.0)?
a source to share
Without using any additional frameworks, Silverlight 3 doesn't support what you've seen in WPF. In particular, full support for Commanding. Silverlight 4 included Commanding for Buttons, which is a start.
You can look at other frameworks that provide this feature set, like Prism . This will get you on the right track, but I'm sure there are other options.
a source to share
Other options include things like MVVM Light, which is a lighter weight alternative to Prism for things like event and command handling, however Prism has a lot of functionality (and in Prism 4 talk, it sounds like a good option when it gets released) ...
One good site for the community is the Composite Development Patterns Community , which was recently launched but has an excellent goal of collecting articles and other help for working with development patterns like MVVM.
Finally, John Papa gives a great link-limited overview of MVVM, so head over to Google and see "John Papa MVVM". :)
However, it is worth considering that the resources for SL3 will not be as valuable as for SL4, which opens up additional possibilities for framework-based management (the ICommand that Greglev talked about), although this is not yet a complete WPF support team.
a source to share