PastingCellClipboardContent not firing after new row

8 posts, 0 answers
  1. Lynda Golomb
    Lynda Golomb avatar
    40 posts
    Member since:
    Dec 2009

    Posted 11 Oct 2015 Link to this post

    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.

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Oct 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Lynda Golomb
    Lynda Golomb avatar
    40 posts
    Member since:
    Dec 2009

    Posted 15 Oct 2015 Link to this post

    No, my grid has definition

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

    I'm using AddingNewDataItem to add a new row.

     

     ​

  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Oct 2015 Link to this post

    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
  6. Lynda Golomb
    Lynda Golomb avatar
    40 posts
    Member since:
    Dec 2009

    Posted 15 Oct 2015 in reply to Maya Link to this post

    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....

  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Oct 2015 Link to this post

    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
  8. Lynda Golomb
    Lynda Golomb avatar
    40 posts
    Member since:
    Dec 2009

    Posted 20 Oct 2015 Link to this post

    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!!

  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Oct 2015 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready