title: How to Get a Reference to a ViewModel
body: <p>All, I have a custom <code>DataGridView</code> control which overrides the <code>DataGidView</code>'s <code>OnItemsSourceChanged</code> event. Inside this event I need to get a reference to a data set in the relevant ViewModel. Code is </p>
  
  <pre><code>public class ResourceDataGrid : DataGrid
  {
      protected override void OnItemsSourceChanged(
          System.Collections.IEnumerable oldValue, 
          System.Collections.IEnumerable newValue)
      {
          if (Equals(newValue, oldValue)) 
              return;
          base.OnItemsSourceChanged(oldValue, newValue);
  
          ResourceCore.ResourceManager manager = ResourceCore.ResourceManager.Instance();
          ResourceDataViewModel resourceDataViewModel = ?? // How do I get my ResourceDataViewModel
          List&lt;string&gt; l = manger.GetDataFor(resourceDataViewModel); 
          ...
      }
  }
  </code></pre>
  
  <p>On the marked line I want to know how to get a reference to <code>ResourceDataViewModel resourceDataViewModel</code>. The reson is that i have multiple tabs each tab contains a data grid and ascociated ViewModel, the ViewModel holds some data that I need to retrieve [via the <code>ResourceManager</code>] (or is there another, better way?).</p>
  
  <p>The question is, from the above event, how can I get the ascociated <code>ResourceDataViewModel</code>?</p>
  
  <p>Thanks for your time.</p>