This is a migrated thread and some comments may be shown as answers.

PastingCellClipboardContent not firing after new row

7 Answers 267 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lynda Golomb
Top achievements
Rank 1
Lynda Golomb asked on 11 Oct 2015, 06:54 AM

Hi,

I have used PastingCellClipboardContent event on a wpf radgridview in order to convert the value pasted to a value in a combobox as described in: http://docs.telerik.com/devtools/wpf/controls/radgridview/clipboard/pasting.html

My grid has definition:

ClipboardCopyMode="Cells"
ClipboardPasteMode="Cells"​

However, when copying a cell, then adding a new row and then trying to paste the content, this event does not fire (and produces very odd behaviour in the grid, but that's besides the point).

Any ideas?

Thanks.

7 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 15 Oct 2015, 06:35 AM
Hi Lynda,

ClipboardPasteMode property provides an option for inserting an item on pasting (setting it to "InsertNewRows"). Is that what you are trying or you are inserting new items in another way ? 

Regards,
Maya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lynda Golomb
Top achievements
Rank 1
answered on 15 Oct 2015, 08:22 AM

No, my grid has definition

My grid has definition:
ClipboardCopyMode="Cells"
ClipboardPasteMode="Cells"​

I'm using AddingNewDataItem to add a new row.

 

 ​

0
Maya
Telerik team
answered on 15 Oct 2015, 02:43 PM
Hi Lynda,

Could you try setting the pasting mode so that it inserts new items and verify whether it behaves as you require ? 

Regards,
Maya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lynda Golomb
Top achievements
Rank 1
answered on 15 Oct 2015, 03:15 PM

No, it doesn't work.... I'm getting an exception "Cell is not valid". I think that the grid is trying to create a new row that's not what I need.
I don't want paste to create a new row. Also, after changing the definition, regular paste stopped working (from cell to cell).
I want paste to a cell to copy the value that I copied from a cell before a new row was created. If this event is supposed to be raised upon paste on a cell, why not after a row is added?

I just need copy paste to work from cell to cell on different rows, whether it's an existing row or a new row....

0
Maya
Telerik team
answered on 19 Oct 2015, 12:28 PM
Hello Lynda,

Could you take a look at the project attached and let me know how it should be modified so that it follows your scenarios ? What are the steps I need to follow in order to get similar behavior as the one on your side ? 

Regards,
Maya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Lynda Golomb
Top achievements
Rank 1
answered on 20 Oct 2015, 07:25 AM

Hi Maya

Thanks for  your reply. I reproduced the issue in the project.

Modify the Grid definitions like this:
<telerik:RadGridView Grid.Row="0" 
                             Name="clubsGrid" 
                             ItemsSource="{Binding Clubs}"
                             AutoGenerateColumns="False"
ClipboardCopyMode="Cells"
ClipboardPasteMode="Cells"
                             CanUserInsertRows="True"
                             GroupRenderMode="Flat"
                             NewRowPosition="Bottom"
                             AddingNewDataItem="clubsGrid_AddingNewDataItem"
                             PastingCellClipboardContent="clubsGrid_OnPastingCellClipboardContent"
                             SelectionUnit="Cell"
                             Margin="5">

 

Add to MainWindow.xaml.cs:
private void clubsGrid_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e)
        {            
            var club = new Club();
            e.NewObject = club;
        }

        private void clubsGrid_OnPastingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
        {
            //here you can see that if I copy/paste a cell regularly - the event is reached
            //follow this scenario:
            //1. Copy a cell
            //2. Add new row
            //3. Try to paste to a cell in the new row
            //4. You will not reach this event
            MessageBox.Show("Reached Event!!");            
        }

To reproduce:
1. Copy a cell on one row
2. Paste to cell in another row (same column) - you can see the event OnPastingCellClipboardContent is reached
3. Now copy a cell again
4. Add a new row
5. Try to paste to a cell in the new row
6. You will see the event is not reached

Thanks so much!!

0
Maya
Telerik team
answered on 21 Oct 2015, 08:33 AM
Hello Lynda,

That would be the expected behavior since you are not pasting on the grid but rather on a TextBox (when inserting a new items, the first cell is in edit mode and the editing element is a TextBox). It on the other hand handles the pasting.
You can check out one of the following links for further reference (link 1, link 2, link 3).

Regards,
Maya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Lynda Golomb
Top achievements
Rank 1
Answers by
Maya
Telerik team
Lynda Golomb
Top achievements
Rank 1
Share this question
or