title: How to binding list item to whether it is contained in another collection
body: <p>The scenario is that we have a list of items displayed in a list (ListView on Android and UITableView on iOS). The ItemSource comes from a web service. In addition to the data properties of the item, each of the items has the additional state that it can be added to a collection of currently selected items which is reflected in another collection on the view model.</p>
  
  <p>I need to be able to alter the display of the item in the list based on whether it is in the currently selected list.</p>
  
  <p>The datacontext given for binding is the data that comes from the ItemsSource, which is jsut the raw data for an item and has no way of knowing if that data is one of the currently selected items. That has to be done by asking the ViewModel.</p>
  
  <p>I'm struggling to find the best solution to this problem. I certainly do not want to modify the ItemsSource to add a bogus property to each item in the source.</p>
  
  <p>I can hack something around it by overriding the Adapter/TableViewSource to hardcode this without actually using binding for this, but that seems wrong.</p>
  
  <p><strong>Update</strong></p>
  
  <p>That was not explained very well, so let me try to explain using an existing MvvmCross example as the basis.</p>
  
  <p>Consider the books sample from N=6 and N=7. We want to add a new feature where we can mark the books that we already own and for those that we have marked it shows an indicator to tell you that you own the book.</p>
  
  <p>Imagine that the view model has methods like:</p>
  
  <pre><code>public bool IsOwned(string id)
  public void SetOwned(string id, bool owned)
  </code></pre>
  
  <p>The implementation of those is not important for this discussion, but I would probably also need some form of Event Handler to notify when ownership has changed for a book.</p>
  
  <p>I am trying to figure out how I can set up a binding on the ListViewItem/TableViewCell so that it can query the IsOwned method on the ViewModel using the ID from the DataContext for the item to control visibility of a UI element in that record.</p>
  
  <p>I'm guessing that I will have to create a custom source binding, but that binding has to reference the ViewModel and the DataContext so I am a little lost here.</p>
  
  <p>Note that in my real problem I am trying to solve, the status of whether something is marked is temporary and local only to the ViewModel (if I exit the screen it is not remembered). This precludes the idea of having a Service for getting the information.</p>