They are typically built to reflect a View. This is where the majority of your code-behind goes: data access, click events, complex calculations, business rules validation, etc. It is OK to put code behind your view IF that code is related to the View only, such as setting focus or running animations. In most cases, they can be DataTemplates which is simply a template that tells the application how to display a class. They are not responsible for getting data, saving data, click events, complex calculations, business rules, or any of that stuff. They should only contain properties and property validation. Models are simple class objects that hold data. The problem is, there are a lot of online resources for MVVM, each with their own way of implementing the design pattern and it can be overwhelming. I would like to present MVVM in the simplest way possible using just the basics. It is perfectly suited to the technology and allows you to keep your code clean and easy to maintain. In my opinion, if you are using WPF or Silverlight you should be using the MVVM design pattern.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |