title: Prevent Silverlight datagrid selectionchanged from killing button click?
body: <p>I have a datagrid in Silverlight that has a template column in it containing a button. Looks basically like this in XAML -</p>
  
  <pre><code>&lt;sdk:DataGrid ItemsSource="{Binding Items}" SelectedItem="{Binding Selected, Mode=TwoWay}"&gt;
              &lt;sdk:DataGrid.Columns&gt;
                  &lt;sdk:DataGridTemplateColumn&gt;
                      &lt;sdk:DataGridTemplateColumn.CellTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;Button HorizontalAlignment="Right" Click="btn_Click"&gt;
                                  &lt;StackPanel Orientation="Horizontal"&gt;
                                      &lt;Image Source="/image.png"/&gt;
                                  &lt;/StackPanel&gt;
                              &lt;/Button&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/sdk:DataGridTemplateColumn.CellTemplate&gt;
                  &lt;/sdk:DataGridTemplateColumn&gt;
                  &lt;!-- Ten Other Columns --&gt;
              &lt;/sdk:DataGrid.Columns&gt;
          &lt;/sdk:DataGrid&gt;
  </code></pre>
  
  <p>Now, in this setup, the btn_Click event fires fine whenever that button is clicked (regardless of whether or not the row is selected. All is well until I added a selectionchanged event to the datagrid. The first line of XAML is now this -</p>
  
  <pre><code>&lt;sdk:DataGrid ItemsSource="{Binding Items}" SelectedItem="{Binding Selected, Mode=TwoWay}" SelectionChanged="dg_SelectionChanged"&gt;
  </code></pre>
  
  <p>Now the btn_Click event will only fire if the button that was clicked is on the currently selected row. Otherwise it fires the selectionchanged event only, and never gets to the button click. The selectionchanged event firing I understand, because you are obviously switching the selected row. But what I don't understand is why the btn_Click is never hit. Anyone have ideas on why this is and how to get around it?</p>
  
  <p>Thanks in advance.</p>