Paste mode to the grid

13 posts, 0 answers
  1. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 29 Jul 2019 Link to this post

    Hi Telerik,

     

    I'm using the following RadTreeListView :

    <telerik:RadTreeListView AutoGenerateColumns="False" ItemsSource="{Binding SelectionDetails}" CanUserResizeRows="True" CanUserDeleteRows="False" CanUserReorderColumns="True"ReorderColumnsMode="ReorderColumns" VerticalAlignment="Stretch" ColumnWidth="Auto" GroupRenderMode="Flat" GridLinesVisibility="Both" SelectionMode="Multiple" SelectionUnit="FullRow" FontSize="{StaticResource FontSizeText}" IsReadOnly="{Binding IsReadOnlyMode}" x:Name="rtlvDetails"
                                     AutoExpandItems="True" ValidatesOnDataErrors="InViewMode" ValidationType="None"
                                     SelectionChanged="rtlvDetails_SelectionChanged" EditTriggers="Default" ClipboardPasteMode="AllSelectedCells"
                                     CanUserSelect="False" FrozenColumnCount="3" CellValidating="rtlvDetails_CellValidating" Grid.Row="1" CanUserFreezeColumns="False" IsSynchronizedWithCurrentItem="False"/>

     

    I try to implement the copy (from Excel) / paste (to the grid) like I've implemented in another RadGridView :

    <telerik:RadGridView Margin="5" HorizontalAlignment="Stretch" AutoGenerateColumns="False" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
                                             CanUserFreezeColumns="False" CanUserReorderColumns="False" ItemsSource="{Binding LocalGapTolerances}" IsFilteringAllowed="True"
                                             x:Name="rgvTolerances" Style="{StaticResource StyleRadGridView}" HeaderRowStyle="{StaticResource StyleHeaderRowRadGridView}" SelectionMode="Single"
                                             SelectionUnit="Cell" ClipboardPasteMode="AllSelectedCells" Grid.Row="1" VerticalAlignment="Stretch"/>

     

    But what ever I do about the paste mode properties, the 'Ctrl+V' will never fires any event in my RadTreeListView.

    I need to paste data from Excel in my grid respectings the Columns/Rows order.

     

    Do you know why no event are fired ?

     

    Thank you.

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1070 posts

    Posted 31 Jul 2019 Link to this post

    Hi Valentin,

    The reason why pasting is not performed with this configuration of the RadTreeListView control is that the CanUserSelect property is set to False.

    The control's pasting mechanism needs the selected item(s) in order to perform the operation. What I can suggest is to either enable the selection or handle the process manually by creating a key binding for the Ctrl + V combination.

    I hope this answers your query. Please let me know if I can further assist you in any way.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 31 Jul 2019 in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

     

    Thanks for your answer.

     

    Even if CanUserSelect property is set to True, the past mode doesn't work.

    I've implemented a CheckBox column to Set IsSelected property on my Object Model because I don't want user can select rows with the default selection (= click on each row).

     

    There is another way to make works the past with nativ events ? Or implement a custom Ctrl + V behavior is the only way to do this ?

     

    Thank you.

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    539 posts

    Posted 05 Aug 2019 Link to this post

    Hello Valentin,

    If after setting the CanUserSelect property to True, the pasting is not performed, I am assuming that the IsReadOnly property of the RadTreeListView is True. In that case, the pasting is also disabled. Can you try setting the IsReadOnly property to False and see if that enables the pasting?

    If that is not an option for your scenario, you can also implement the logic manually as suggested by my colleague.

    I hope you find this helpful.

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 08 Aug 2019 in reply to Vladimir Stoyanov Link to this post

    Hi Vladimir,

     

    Thank you for the answer.

     

    The IsReadOnly property is set to True and with the following configuration I can paste one cell from Excel, but the value is applied to all fields.

    <telerik:RadTreeListView AutoGenerateColumns="False" ItemsSource="{Binding SelectionDetails}" CanUserResizeRows="True" CanUserDeleteRows="False" CanUserReorderColumns="True"
                                     ReorderColumnsMode="ReorderColumns" VerticalAlignment="Stretch" ColumnWidth="Auto" GroupRenderMode="Flat" GridLinesVisibility="Both"
                                     SelectionMode="Multiple" SelectionUnit="FullRow" FontSize="{StaticResource FontSizeText}" IsReadOnly="{Binding IsReadOnlyMode}" x:Name="rtlvDetails"
                                     AutoExpandItems="True" ValidatesOnDataErrors="InViewMode" ValidationType="None"
                                     SelectionChanged="rtlvDetails_SelectionChanged" EditTriggers="Default" ClipboardPasteMode="AllSelectedCells"
                                     CanUserSelect="False" FrozenColumnCount="3" CellValidating="rtlvDetails_CellValidating" Grid.Row="1" CanUserFreezeColumns="False" IsSynchronizedWithCurrentItem="False"
                                     CellValidated="rtlvDetails_CellValidated">

     

    I think it's because SelectionUnit property is set to FullRow.

    > I I set it to Mixed or if I want to paste 2 or more cells, the paste mode doesn't work.

     

    Probably, the best way to make works the pasting mode to the grid is to implement manually the behavior like Dilyan said, but I want to know if you can tell me the base to do this (events, best practices, etc...) ?

     

    Thank you very much.

  6. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    539 posts

    Posted 09 Aug 2019 Link to this post

    Hello Valentin,

    Thanks for the provided snippet. 

    I am uncertain whether it is actually necessary to implement the copy/paste functionality manually. Please, check out the attached project in which I tested the paste functionality with both FullRow and Mixed SelectionUnit and on my end it is working as intended. Can you examine it and see how it differs from the setup on your end?

    Should you need any further assistance, may I kindly ask you to share a sample video demonstrating the copy/paste process on your end?

    Regards,
    Vladimir Stoyanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 13 Aug 2019 in reply to Vladimir Stoyanov Link to this post

    Hi Vladimir,

     

    Thanks for the attached project, but I can't build it. I have the following error :

    The tag 'RadTreeListView' does not exist in XML namespace 'http://schemas.telerik.com/2008/xaml/presentation'. In your project, I'm using the same .DLL used in my project.

     

    Added question : Does your sample working with SelectionMode property set to Multiple ?

    Thank you.

  8. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1070 posts

    Posted 14 Aug 2019 Link to this post

    Hi Valentin,

    My name is Dilyan and I'm stepping in for my colleague Vladimir who is currently out of office.

    I was able to successfully run the project Vladimir attached and recorded a short video of the pasting process at my end when using the Multiple SelectionMode. Please find the video attached to my reply.

    In order to run the project Vladimir provided, I can suggest manually re-adding all of the required binary files:

    - Telerik.Windows.Controls.dll
    - Telerik.Windows.Controls.GridView.dll
    - Telerik.Windows.Controls.Input.dll
    - Telerik.Windows.Data.dll

    Should you prefer, you can also use the ReferencesResolver extension to do this manually for you.

    Please let me know whether you're able to successfully run the project and whether the behavior demonstrated in the video is in fact the desired one.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 16 Aug 2019 in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

     

    Thank you for the provided video.

     

    It's very strange because is not the first Telerik project I tried to manipulate but only this one doesn't build, even after I added needed references.

    The ReferencesResolver doesn't change anything.

     

    For the fourth .dll files I'm using version n° : 2017.2.614.45

     

    I can't build the project :( => I attached to this post a screen of my problem.

     

    Thakn you for your help.

  10. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1070 posts

    Posted 19 Aug 2019 Link to this post

    Hi Valentin,

    Thank you for the provided image.

    The error you observe is caused by the fact that the provided project targets .NET Framework 4.0 and the .dll files which are referenced are meant for the 4.5 version of the framework.

    In order to successfully build and run the project, either change the project's version to 4.5 or reference the 4.0 binaries from the WPF40 folder of your UI for WPF installation.

    Please let me know how this goes.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  11. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 21 Aug 2019 in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

     

    Thank you for your answer.

    Now, I can run your sample project, and its working fine.

    With the same configurations, the behavior doesn't working on my project and I don't know why.

     

    Thank you.

  12. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1070 posts

    Posted 22 Aug 2019 Link to this post

    Hi Valentin,

    In order for me to assist you further, would you find it possible to isolate the issue you're experiencing in your project in a smaller sample project? You can upload the project to a storage provider of your choice and provide a download link. I will then be more than happy to investigate the cause of the undesired behavior and suggest a viable solution.

    Please let me know whether you would find this possible.

    Regards, Dilyan Traykov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  13. Valentin
    Valentin avatar
    155 posts
    Member since:
    Mar 2016

    Posted 23 Oct 2019 in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

     

    To do my work I've implemented properties like this :

    SelectionMode="Single" SelectionUnit="Mixed" CanUserSelect="True"

    => The disadvantage of this way is the row isn't fully selected, but the behavior (copy/paste) working find.

     

    Thank you for your help !

Back to Top