title: WPF DataContext inheritance confusion
body: <p>I have <code>UserControl</code> with two <code>DependencyProperties</code>. I'm trying to understand how <code>DataContext</code> works here, because it seems inconsistent for me and it's probably somethin obvious that I'm missing. </p>
  
  <p>My user control:</p>
  
  <pre><code>&lt;UserControl x:Class="XYZ.MyControl" xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf" ...&gt;
      &lt;Grid x:Name="RootGrid"&gt;
          &lt;oxy:Plot Title="{Binding ChartTitle}" x:Name="PlotxName" IsLegendVisible="False"&gt;
                  .
                  .
                  .
              &lt;oxy:LineSeries Title="test" ItemsSource="{Binding Items}" DataFieldX="X" DataFieldY="Y" MarkerType="Circle"&gt;
                  &lt;oxy:LineSeries.LabelFormatString&gt;{1}&lt;/oxy:LineSeries.LabelFormatString&gt;
                  &lt;oxy:LineSeries.XAxisKey&gt;X1&lt;/oxy:LineSeries.XAxisKey&gt;
              &lt;/oxy:LineSeries&gt;
          &lt;/oxy:Plot&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>My code behind:</p>
  
  <pre><code>public partial class MyControl: UserControl
  {
  
      #region ChartTitle
      public string ChartTitle
      {
          get { return (string)GetValue(ChartTitleProperty); }
          set { SetValue(ChartTitleProperty, value); }
      }
  
      public static readonly DependencyProperty ChartTitleProperty =
          DependencyProperty.Register("ChartTitle", typeof(string), typeof(MFPlot), new PropertyMetadata(""));
      #endregion
  
      #region Items
      public ObservableCollection&lt;Item&gt; Items
      {
          get { return (ObservableCollection&lt;Item&gt;)GetValue(ItemsProperty); }
          set
          {
              SetValue(ItemsProperty, value);
          }
      }
  
      public static readonly DependencyProperty ItemsProperty =
          DependencyProperty.Register("Items", typeof(ObservableCollection&lt;Item&gt;), typeof(MFPlot), new PropertyMetadata(new ObservableCollection&lt;Item&gt;(), ItemsPropertyChanged));
          .
          .
          .
      #endregion
  
      public MyControl()
      {
          SetValue(ItemsProperty, new ObservableCollection&lt;Item&gt;()); //overwrite default collection to avoid using the same one by all MyControls
          InitializeComponent();
          RootGrid.DataContext = this; //parent element
      }
  }
  </code></pre>
  
  <p>How I use this control:</p>
  
  <pre><code>&lt;Page xmlns:local="clr-namespace:XYZ" ...&gt;
      &lt;local:MyControl Items="{Binding SubItemsTre}" ChartTitle="TEST TITLE"/&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>With this setup, <code>RootGrid</code> DataContext (set as per last line of code behind) should be inherited by it's descendants, right? This works for <code>Title</code> property of <code>&lt;oxy:Plot&gt;</code>, it displays correctly "TEST TITLE". However, it doesn't work for <code>ItemsSource</code> property of <code>&lt;oxy:LineSeries&gt;</code>. It's DataContext is still the same as <code>MyControl</code>'s <strong>parent</strong> i.e. Page, not the same as <code>RootGrid</code>. I have wasted a lot of time on this and found out that I have to add <code>DataContext="{Binding}"</code> to <code>&lt;oxy:Plot&gt;</code>. Why is that? Why one element seems to inherit it's parent <code>DataContext</code> while the other doesn't? Is it because <code>&lt;oxy:LineSeries&gt;</code> is child of <code>&lt;oxy:Plot&gt;</code>, not <code>RootGrid</code>?</p>