Articles in this section
Category / Section

How to copy one row and paste it into all the selected rows like Excel in the WinRT SfDataGrid?

2 mins read

In SfDataGrid, by default you can copy one row and paste it into another row. When you need to copy one row and paste it into the selected rows, you can override GridCutCopyPaste. GridCutCopyPaste class consists of many overrides to customize copy paste operations. To achieve the above requirement, you can override PasteToRows (object clipboardrows) as in the following code example.


this.sfdatagrid.GridCopyPaste = new CustomCopyPaste(sfdatagrid);
public class CustomCopyPaste : GridCutCopyPaste
    public CustomCopyPaste(SfDataGrid sfgrid)
        : base(sfgrid)
    protected override void PasteToRows(object clipboardrows)
        var data = (IList)clipboardrows;
        //Gets the ClipbordText and check if the clipboard text is more than one row
        //means call the base.
        if (data.Count > 1)
        //Gets the Selected records for paste the copied row.
        var selectedrecord = this.dataGrid.SelectedItems;
        for (int i = 0; i < selectedrecord.Count; i++)
            var selectedRecords = selectedrecord[i];
            // Calls the PasteToRow method with copiedrecord and selectedrecord
            PasteToRow(data[0], selectedRecords);

Sample Links:






Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied