Empty RadGridView breaking on paste

2 posts, 0 answers
  1. Eric
    Eric avatar
    2 posts
    Member since:
    Feb 2013

    Posted 20 Feb 2013 Link to this post

    RadGridView breaks when you have no data in it and you try and paste. I get a DataGrid_DisplayIndexOutOfRange exception. Here is an example: 

    <Window x:Class="TestTablePaste.MainWindow"
                    Title="MainWindow" Height="350" Width="525">
                        <telerik:RadMenuItem Header="Paste" Command="ApplicationCommands.Paste"></telerik:RadMenuItem>

    I was wondering if this is a known issue and if there was a work around.
  2. Yoan
    Yoan avatar
    1182 posts

    Posted 25 Feb 2013 Link to this post

    Hi Eric,

    I have already answered your ticket containing the same question. However, I will post my answer here as well in case anyone experience the same behavior:

    Actually, this would be an expected behavior, because by design RadGridView throws this exception in order to handle an invalid cases (in this situation, the exception is thrown in order to notify you that you can not paste in a column which does not exist). 

    In order to prevent this behaviour, you can handle the event that corresponds to the Paste command (Pasting event of the RadGridView). You could cancel it and then execute any additional logic in it.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top