title: DependencyProperty with ObservableCollection bound to a Datagrid
body: <p>I am trying to learn a new thing in WPF, and I just can't get it to work. I have declared a DependencyProperty, and I am trying to use it to bind a observable collection to a datagrid.
  This is my code:</p>
  
  <pre><code>public static readonly DependencyProperty dpActivityProperty =
              DependencyProperty.Register("dpActivity",
              typeof(ObservableCollection&lt;Activity&gt;),
              typeof(MainWindow));
  
          public ObservableCollection&lt;Activity&gt; dpActivity
          {
              get { return (ObservableCollection&lt;Activity&gt;)GetValue(dpActivityProperty); }
              set { SetValue(dpActivityProperty, value); }
          }
  </code></pre>
  
  <p>Here is my xaml:</p>
  
  <pre><code>&lt;WpfToolkit:DataGrid Name="DG1" ItemsSource="{Binding dpActivity,ElementName=Utils}"
  </code></pre>
  
  <p>Utils is the x:Name of the mainwindow.</p>
  
  <p>The problem I am having is that no data is displayed in my datagrid. There are no binding errors, and I can see the data if I don't use the dependency property and just set the itemssource to the observable collection. I have tried to google this, and no luck. Can anyone point me in the right direction?</p>
  
  <p>I put another datagrid on the project, and set autogeneratecolumns=true. This displays the data from dpActivity. the error must be in this code:</p>
  
  <pre><code>&lt;WpfToolkit:DataGrid.Columns&gt;
                                  &lt;WpfToolkit:DataGridTextColumn
                                      Header="Sport"
                                      Width="90"
                                      Binding="{Binding Path=Sport}" /&gt;
  </code></pre>
  
  <p>There are still no binding errors.</p>
  
  <p>Wow! I am sorry I wasted everyone's time, I found a DG1.ItemsSource = Null statement that I forgot to comment out. That overrode everything to give me a empty datagrid. Everything works great now. Sorry again</p>