Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my opinion, for what it's worth :</p> <p>I don't really agree with the approach you suggest (except for the dumb view). In real life, you will often have to use an existing model : it could be legacy code that you don't have the time (or will) to change, or even a library for which you don't have the code. In my opinion, the model should be completely unaware of the way it will be displayed, and should be easily usable in a non-WPF application. So it doesn't have to implement any specific interface like <code>INotifyPropertyChanged</code> of <code>INotifyCollectionChanged</code> to make it usable in MVVM. I think that all the logic related to UI should reside in the ViewModel.</p> <p>Regarding <code>RoutedEvents</code> and <code>RoutedCommands</code>, they are not really suitable for use with the MVVM pattern. I usually try to use as little <code>RoutedEvents</code> as possible, and no <code>RoutedCommands</code> at all. Instead, my ViewModels expose <code>RelayCommand</code> properties that I bind to the UI in XAML (see <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="noreferrer">this article</a> by Josh Smith for details on <code>RelayCommand</code>). When I really need to handle events for some control, I use attached behaviors to map the events to ViewModel commands (have a look at <a href="http://marlongrech.wordpress.com/2008/12/13/attachedcommandbehavior-v2-aka-acb/" rel="noreferrer">Marlon Grech's implementation</a>)</p> <p>So, in summary :</p> <ul> <li>Dumb View</li> <li>Big and smart ViewModel</li> <li>Any model you want or have to use</li> </ul> <p>Of course it's just my approach, and it may not be the best, but I feel quite comfortable with it ;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload