Hierarchical radgridview clipboard

4 posts, 1 answers
  1. Loic
    Loic avatar
    7 posts
    Member since:
    May 2014

    Posted 16 Oct 2014 Link to this post

    Hello,

    I have a hierarchical radgridview and I would like to be able to copy / paste data from the grid to an excel spreadsheet either from the parent grid either from the child grid.
    I use the rowdetailstemplate to load a view containing the child grid. The copy works for the parent grid, but selection is off and copy just does not work for the second grid.

    Parent :
     
    <telerik:RadGridView  x:Name="RadGridView1"    
                                  Grid.Row="2"
                                  ItemsSource="{Binding ResultsViewModelList}" AutoGenerateColumns="False"
                                  custom:GridViewDataColumnsBehavior.BindableColumns="{Binding ColumnCollection}"
                                  SelectionMode="Extended"
                                  ScrollViewer.VerticalScrollBarVisibility="Visible"
                                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                  ColumnWidth="150" GroupRenderMode="Flat"
                                  EnableColumnVirtualization="False"
                                  ClipboardCopyMode="All"
                                  >
                <telerik:RadGridView.RowDetailsTemplate>
                    <DataTemplate >
                        <vw:ResultView DataContext="{Binding}"/>
                    </DataTemplate>
                </telerik:RadGridView.RowDetailsTemplate>
            </telerik:RadGridView>

    child:

    <telerik:RadGridView Name="radGridView1" AutoGenerateColumns="True"   ItemsSource="{Binding Path=ItemsList}"
                              ColumnWidth="150" GroupRenderMode="Flat" EnableColumnVirtualization="False" EnableRowVirtualization="False"
                              ClipboardCopyMode="All" SelectionMode="Multiple" SelectionUnit="FullRow">
         </telerik:RadGridView>

  2. Answer
    Boris
    Admin
    Boris avatar
    276 posts

    Posted 21 Oct 2014 Link to this post

    Hello Loic,

    I am not entirely sure what you mean by: "selection is off and copy just does not work for the second grid". Did you mean that the first item of the child grid is not selected automatically, when it is expanded? If that is so you can set the IsSynchronizedWithCurrentItem property of the child grid to "True". However, if you meant that you cannot select the items manually, you will need to provide us with more details about your case. 

    I tried to reproduce the selection issue, however it seams that I am able to select manually the items of the child grid and copy / paste them in a excel file. Could you please examine the attached project and let us know if there are any differences regarding how the selection is made? 

    Regards,
    Boris Penev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Loic
    Loic avatar
    7 posts
    Member since:
    May 2014

    Posted 22 Oct 2014 in reply to Boris Link to this post

    Concerning the selection, I misinterpret the "multiple" mode, so this is fine.
    For the copy / paste, it works as expected in your sample but not in my project. I cannot find why at the moment but I will try to find a solution.

    Thanks.
  4. Loic
    Loic avatar
    7 posts
    Member since:
    May 2014

    Posted 22 Oct 2014 Link to this post

    For information,

    my source object was wrongly overriding the GetHashCode method and because of that the gridview could not select or copy properly the rows.
Back to Top