/// <summary>
 /// Raises the System.Windows.Controls.DataGrid.SelectedCellsChanged event.
 /// </summary>
 /// <param name="e">The data for the event.</param>
 protected override void OnSelectedCellsChanged(SelectedCellsChangedEventArgs e)
 {
     // base.OnSelectedCellsChanged(e);
     if (e.AddedCells != null && e.AddedCells.Count == 1)
     {
         DataGridCellInfo cellInfo = e.AddedCells[0];
         if (!cellInfo.IsValid)
         {
             return;
         }
         FrameworkElement cellContent = cellInfo.Column.GetCellContent(cellInfo.Item);
         if (cellContent == null)
         {
             return;
         }
         DataGridCell dataGridCell = (DataGridCell)cellContent.Parent;
         if (dataGridCell == null)
         {
             return;
         }
         Point relativePoint = dataGridCell.TransformToAncestor(this).Transform(new Point(0, 0));
         Point startPosition = new Point(relativePoint.X - 3, relativePoint.Y - 3);
         Point endPosition   = new Point(relativePoint.X + dataGridCell.ActualWidth, relativePoint.Y + dataGridCell.ActualHeight);
         UpdateSelectionRectangle(startPosition, endPosition);
     }
 }