static void ClearSelectionIfRowIsNotBeSelectable(DataGrid grid, RowViewModel firstSelectedRowFound)
 {
     if (firstSelectedRowFound != null && !firstSelectedRowFound.IsSelectable)
     {
         grid.SelectedCells.Clear();
     }
 }
        /// <summary>
        /// Prevents User from selecting items from different Rows, as it doesn't make sense to analyse them together
        /// </summary>
        /// <param name="grid"></param>
        static void LimitSelectionToOneRow(DataGrid grid)
        {
            RowViewModel firstSelectedRowFound = null;

            foreach (DataGridCellInfo gridCellInfo in grid.SelectedCells)
            {
                if (firstSelectedRowFound == null)
                {
                    firstSelectedRowFound = (RowViewModel)gridCellInfo.Item;
                }
                else if (IsOnAnotherRow(gridCellInfo, firstSelectedRowFound))
                {
                    grid.SelectedCells.Remove(gridCellInfo);
                }
            }

            ClearSelectionIfRowIsNotBeSelectable(grid, firstSelectedRowFound);
        }
 static bool IsOnAnotherRow(DataGridCellInfo gridCellInfo, RowViewModel firstFoundSelectedRow)
 {
     return(gridCellInfo.Item != firstFoundSelectedRow);
 }