title: Clear selected row data in wpf datagrid?
body: <p>Hi everyone i am new to wpf and i got stuck at one point.I want to delete my datagrid row in wpf row by selecting that row .Till now i have searched a lot and written following code but all in vain.
  Code is:</p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
      {
          var g1 = dg;
          var g2 = dg;
  
          if (g1.SelectedIndex &gt;= 0)
          {
              for (int i = 0; i &lt;= g1.SelectedItems.Count; i++)
              {
                  g2.Items.Remove(g1.SelectedItems[i]);
              }
          }
          g1 = g2;
      }
  </code></pre>
  
  <p>Any suggestion would be highly appreciable.</p>