title: Binding two viewmodel's with different hierarchy to one model
body: <p>I have viewport3d with entities, and treeview with hierarchical structure of that entities. Treeview is binded from class hierarchy, something like this:</p>
  
  <pre><code>public class SomeDataObject
  {
      private ObservableCollection&lt;SomeDataObject&gt; _children;
      private string _OtherProperty;
  
      public SomeDataObject()
      {
          this._children = new ObservableCollection&lt;SomeDataObject&gt;();
          //other initialization
      }
  
      public ObservableCollection&lt;SomeDataObject&gt; Children
      {
          get
          {
              return this._children;
          }
          set{ _children = value; }
      }
  
      public string OtherProperty
      {
          get
          {
              return this._OtherProperty;
          } 
          set{ _OtherProperty = value; }  
      }
  }
  </code></pre>
  
  <p>I would like to bind to viewport only OtherProperty of all objects, without the hierarchy. 
  Viewport provides binding from ObservableCollection, but does not include the ancestors. Therefore do not have access to OtherProperty in lower levels.</p>
  
  <p>I think about two separate viewmodels, but I don't know how to design the communication between different viewmodel's.</p>
  
  <p>I found that solution:
  <a href="http://blog.quantumbitdesigns.com/2008/07/22/programmatically-selecting-an-item-in-a-treeview/" rel="nofollow noreferrer">http://blog.quantumbitdesigns.com/2008/07/22/programmatically-selecting-an-item-in-a-treeview/</a>
  but of course this is roundabout way. 
  I would like to automatically update changes in the viewmodels and model.</p>
  
  <p>What is the best solution in such cases?</p>
  
  <p>EDIT:
  This is XAML for treeview:</p>
  
  <pre><code>    &lt;TreeView Grid.Column="0" Name="MainTreeView"&gt;
        &lt;TreeView.Resources&gt;
          &lt;HierarchicalDataTemplate DataType="{x:Type WpfTreeViewTricks:SomeDataObject}"  ItemsSource="{Binding Path=Children}"&gt;
            &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="TreeViewItem:"/&gt;
              &lt;TextBlock Margin="1,0,0,0" Text="{Binding Path=OtherProperty}"/&gt;
            &lt;/StackPanel&gt;
          &lt;/HierarchicalDataTemplate&gt;
        &lt;/TreeView.Resources&gt;
      &lt;/TreeView&gt;
  </code></pre>
  
  <p>and it's work.</p>
  
  <p><img src="https://i.stack.imgur.com/u8S0G.png" alt="enter image description here"></p>
  
  <p>The problem is with bind that hierarchical structure to the viewport, beacase viewport allow binding in following way:</p>
  
  <pre><code>&lt;ht:HelixViewport3D ItemsSource="{Binding Objects}" Background="{ht:LinearGradientBrush Gray, White}"/&gt;
  </code></pre>
  
  <p>where Objects is a property of DataContext:</p>
  
  <pre><code>public ObservableCollection&lt;Visual3D&gt; Objects { get; set; }
  </code></pre>