title: Bind to the page datacontext from a combo box in a data grid
body: <p>I have a page with a view model. I am trying set the binding source of a combo box from a templated DataGrid column to the view model. It gives me a null reference error.</p>
  
  <p>This is my XAML:</p>
  
  <pre><code>&lt;navigation:Page.Resources&gt;
      &lt;vm:SiteViewModel x:Key="viewModel" /&gt;
  &lt;/navigation:Page.Resources&gt;
  &lt;navigation:Page.DataContext&gt;       
      &lt;Binding Source="{StaticResource viewModel}" /&gt;
  &lt;/navigation:Page.DataContext&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>&lt;data:DataGrid ItemsSource="{Binding CurrentSite.Contacts}"&gt; 
      &lt;data:DataGrid.Columns&gt;
      &lt;data:DataGridTemplateColumn Header="Role"&gt;
                              &lt;data:DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;                                
                                      &lt;ComboBox ItemsSource="{Binding Path=Roles, Source=????}"  &gt;
                                          &lt;ComboBox.ItemTemplate&gt;
                                              &lt;DataTemplate&gt;
                                                  &lt;StackPanel Orientation="Horizontal"&gt;
                                                      &lt;TextBlock Text="{Binding Path=RoleName}" VerticalAlignment="Center" /&gt;
                                                  &lt;/StackPanel&gt;
                                              &lt;/DataTemplate&gt;
                                          &lt;/ComboBox.ItemTemplate&gt;
                                      &lt;/ComboBox&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/data:DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/data:DataGridTemplateColumn&gt;
      &lt;/data:DataGrid.Columns&gt;
  &lt;/data:DataGrid&gt;
  </code></pre>