protected virtual void OnExecutedPaste() { OnBeginningEdit(new DataGridBeginningEditEventArgs(Columns.First(), new DataGridRow(), new RoutedEventArgs())); var rowData = ClipboardHelper.ParseClipboardData(); var minColumnDisplayIndex = SelectedCells.Min(x => x.Column.DisplayIndex); var maxColumnDisplayIndex = SelectedCells.Max(x => x.Column.DisplayIndex); var minRowIndex = SelectedCells.Min(y => Items.IndexOf(y.Item)); var maxRowIndex = SelectedCells.Max(y => Items.IndexOf(y.Item)); // If single cell select, then use as a starting cell rather than limiting the paste if (minColumnDisplayIndex == maxColumnDisplayIndex && minRowIndex == maxRowIndex) { maxColumnDisplayIndex = Columns.Count - 1; maxRowIndex = Items.Count - 1; } var rowDataIndex = 0; for (var i = minRowIndex; i <= maxRowIndex && rowDataIndex <= rowData.Count() - 1; i++, rowDataIndex++) { var columnDataIndex = 0; for (var j = minColumnDisplayIndex; j <= maxColumnDisplayIndex && columnDataIndex <= rowData[rowDataIndex].Length - 1; j++, columnDataIndex++) { var column = ColumnFromDisplayIndex(j); if (column.IsReadOnly) { continue; } column.OnPastingCellClipboardContent(Items[i], rowData[rowDataIndex][columnDataIndex]); } } }