title: How to obtain the reference of a button inside a datagrid in the viewmodel in silverlight?
body: <p>i have a datagrid declared in the xaml as follows:</p>
  
  <pre><code>&lt;sdk:DataGrid x:Name="ProductsForProjectDataGrid" AutoGenerateColumns="True" ItemsSource="{Binding Path=Products.ProductsForProject}"&gt;
                    &lt;sdk:DataGrid.Columns&gt;
              &lt;sdk:DataGridTemplateColumn x:Name="DeleteTemplate" Width="10*"&gt;
                  &lt;sdk:DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
  
                          &lt;Button x:Name="DeleteProductButton" Command="{Binding DeleteProductCommand}" CommandParameter="Products.SelectedProduct" &gt;
  
                              &lt;Button.Content&gt;
  
                                  &lt;Image x:Name="DeleteProductImage" Visibility="Visible" Height="20" Source="C:\Documents and Settings\DELETE.GIF" Width="20"/&gt;
                              &lt;/Button.Content&gt; 
                          &lt;/Button&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/sdk:DataGridTemplateColumn.CellTemplate&gt;
              &lt;/sdk:DataGridTemplateColumn&gt;
              &lt;sdk:DataGridTextColumn Binding="{Binding Product}" Header="Product Name" IsReadOnly="True" Width="40*"/&gt;                          
  
          &lt;/sdk:DataGrid.Columns&gt;
  
      &lt;/sdk:DataGrid&gt;
  </code></pre>
  
  <p>and in the viewModel i've to link the button to a command, i can get the reference to the datagrid using this,</p>
  
  <pre><code>_dlgProducts.ProductsForProjectDataGrid
  </code></pre>
  
  <p>where _dlgproducts is the object,
  now how can i get a reference to the delete button,
  once i get the reference i can bind a command to it,
  i need something like</p>
  
  <pre><code>_dlgProducts.ProductsForProjectDataGrid.DeleteProductButton
  </code></pre>
  
  <p>or something, im not sure how to get it...</p>
  
  <p>Thanks :)</p>