title: WPF: binding through custom dependency property
body: <p>I have an <code>TabControl</code> bound to a <code>Dictionary</code> and has a custom control as it's <code>ContentTemplate</code>. The custom control has a custom dependency property <code>Schedules</code> and it's <code>DataContext</code> is bound to a <code>ViewModel</code>, Here is how it look like:</p>
  
  <p>Main control:</p>
  
  <pre><code>&lt;TabControl Grid.Row="1"  ItemsSource="{Binding Schedules}"&gt;
      &lt;TabControl.ContentTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;TabControl &gt;
                  &lt;TabItem Header="Scheduled flights"&gt;
                      &lt;views:MyViewer Schedules="{Binding Value}"/&gt;
                  &lt;/TabItem&gt;
              &lt;/TabControl&gt;
          &lt;/DataTemplate&gt;
      &lt;/TabControl.ContentTemplate&gt;
  &lt;/TabControl&gt;
  </code></pre>
  
  <p>In <code>MyViewer</code>, I also have an <code>DataGrid</code> that I want it to be bound the <code>Schedules</code> passed from the <code>TabControl</code>, but in the same time <code>MyViewer</code> has a <code>ViewModel</code> assigned to it. This is how it looks like in <code>MyViewer</code>:</p>
  
  <pre><code>&lt;DataGrid Grid.Row="1" ItemsSource="{Binding RelativeSource={RelativeSource  Mode=FindAncestor, AncestorType=UserControl}, Path=Schedules}" AutoGenerateColumns="False" &gt;
  </code></pre>
  
  <p>So far this is not working, when <code>MyViewer</code> is loaded <code>Schedules</code> property is <code>null</code>. But even if it works, I would want the Schedules to be passed to the <code>ViewModel</code> not code behind. One idea is to populate the Dictionary with <code>ViewModels</code> of <code>MyViewer</code>, but I do not wish to do this, I only want the Main control to know about details of <code>MyViewer</code>. So any clean idea to solve this?</p>
  
  <p><strong><em>EDIT:</em></strong>
  The proposition above does work after changing to <code>ObservableDictionary</code>, but the question remains, how to have the <code>Schedules</code> in the <code>ViewModel</code></p>