title: How to implement Master-Detail with Multi-Selection in WPF?
body: <p>I plan to create a typical Master-Detail scenario, i.e. a collection of items displayed in a <code>ListView</code> via DataBinding to an <code>ICollectionView</code>, and details about the selected item in a separate group of controls (TextBoxes, NumUpDowns...).</p>
  
  <p>No problem so far, actually I have already implemented a pretty similar scenario in an older project. However, it should be possible to <strong>select multiple items</strong> in the ListView and get the appropriate <strong>shared values displayed</strong> in the detail view. This means, if all selected items have the same value for a property, this value should be displayed in the detail view. If they do not share the same value, the corresponding control should provide some visual clue for the user indicating this, and no value should be displayed (or an "undefined" state in a <code>CheckBox</code> for example). Now, if the user edits the value, this change should be applied to <em>all</em> selected items.</p>
  
  <p>Further requirements are:</p>
  
  <ul>
  <li>MVVM compatibility (i.e. not too much code-behind)</li>
  <li>Extendability (new properties/types can be added later on)</li>
  </ul>
  
  <p>Does anyone have experience with such a scenario? Actually, I think this should be a very common scenario. However, I could not find any details on that topic anywhere.</p>
  
  <p>Thanks!<br/>
  gehho.</p>
  
  <p><strong>PS:</strong> In the older project mentioned above, I had a solution using a subclass of the ViewModel which handles the special case of multi-selection. It checked all selected items for equality and returned the appropriate values. However, this approach had some drawbacks and somehow seemed like a hack because (besides other smelly things) it was necessary to break the synchronization between the <code>ListView</code> and the detail view and handle it manually.</p>