title: Selecting a row in DataGrid
body: <p>i defined an initial Table with three rows. If a user select a row and clicks a "Start new Table" button, it will open a new tabItem with a new Table.
  the Problem is that i dont know how can i select an entire row in my DataGrid.</p>
  
  <pre><code>C# Code:
  //this my initial Table
  private ObservableCollection&lt;TableDataRowStringItem&gt; tableobject = new ObservableCollection&lt;TableDataRowStringItem&gt;();
  List&lt;TableDataRowStringItem&gt; rowstringList = new List&lt;TableDataRowStringItem&gt;();
  TableDataRowStringItem item = new TableDataRowStringItem();
  item.RowNumber = 1; item.saveFlag = true; item.ObjectType = "E"; item.Name = "E"; item.PredecessorRowNumber = "0";
  rowstringList.Add(item);
  item = new TableDataRowStringItem();
  item.RowNumber = 2; item.ObjectType = "Function"; item.Name = "Function";    item.PredecessorRowNumber = "1";
  rowstringList.Add(item);
  item = new TableDataRowStringItem();
  item.RowNumber = 3; item.ObjectType = "E"; item.Name = "E"; item.PredecessorRowNumber = "2";
  rowstringList.Add(item);
  rowstringListEPK = rowstringList;
  for (int i = 0; i &lt; rowstringList.Count; i++)
  {
      tableobject.Add(rowstringList[i]);
  }
  DataGrid1.ItemsSource = tableobject;
  
  
  //Button Code
  foreach (TableDataRowStringItem item in rowstringListEPK)
  {
      if (item.ObjectType == "Function" **(&amp;&amp; Hier i schould write if row.Isselected)**)
      {
         rowStringItem.Name = item.Name;
         tabControl.Items.Add(tabItem);
         tabItem.Focus();
         tabItem.IsSelected = true;
         tabItem.Header = rowStringItem.Name;
         TableTab.Visibility = Visibility.Visible
      }
      else do nothing
  }
  
  //XAML Code
   &lt;DataGrid.RowStyle&gt;
      &lt;Style TargetType="DataGridRow"&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsSelected" Value="True"&gt;
                 &lt;Setter Property="BorderBrush" Value="Blue" /&gt;
                 &lt;Setter Property="BorderThickness" Value="1" /&gt;
                 &lt;Setter Property="AllowDrop" Value="True" /&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
   &lt;/DataGrid.RowStyle&gt;
  </code></pre>