Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In this situation I simply make the model expose <code>ObservableCollection</code>s rather than <code>List</code>s. There's no particular reason why it shouldn't. The <code>ObservableCollection</code> is in the <code>System.Collections.ObjectModel</code> namespace of the <code>System</code> assembly, so there's no unreasonable extra dependencies, you almost certainly have <code>System</code> anyway. <code>List</code> is in <code>mscorlib</code>, but that's as much a historical artefact as anything.</p> <p>This simplifies the model-viewmodel interactions massively, I can't see a reason not to do it, using <code>List</code>s on the model just creates lots of unpleasant boiler-plate code. You are interested in the events, after all.</p> <p>Also, why is your <code>HouseVM</code> wrapping an <code>ObservableCollection&lt;PeopleVM&gt;</code>, rather than <code>ObservableCollection&lt;People&gt;</code>? VMs are for binding to views, so I would think that whatever is binding to your <code>ObservableCollection&lt;PeopleVM&gt;</code> is actually interested in <code>People</code>, otherwise you're binding-within-a-binding, or is there a specific reason why this is useful? I wouldn't generally have a VM expose other VMs, but maybe that's just me.</p> <p><strong>Edit about libraries/WCF</strong></p> <p>I don't see why having a model in a library, or even exposed by a WCF-server should affect whether they raise events or not, it seems perfectly valid to me (obviously the WCF-service won't expose the events directly). If you don't like this, I think you're stuck with having to chain multiple updates, though I wonder if you're actually just manually doing the same work as the event would do in an <code>ObservableCollection</code>, unless I've misunderstood some of it.</p> <p>Personally, like I said, I'd keep the VMs simple, and have them expose the minimum and not expose other VMs. It can take some redesign and make certain parts a bit of a pain (e.g. <code>Converter</code>s, however, you end up with a simple, easy-to-manage design with some simple-to-handle irritations on the edges.</p> <p>It seems to me that your current route is going to end up very complex rather quickly and, most importantly, awkward to follow... However, YMMV, it's just my experience :)</p> <p>Perhaps moving some of the logic to explicit services might help?</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. 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