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

Paste mode to the grid

12 Answers 253 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Valentin
Top achievements
Rank 1
Iron
Iron
Valentin asked on 29 Jul 2019, 02:08 PM

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.

12 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 31 Jul 2019, 01:45 PM
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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 31 Jul 2019, 04:24 PM

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.

0
Vladimir Stoyanov
Telerik team
answered on 05 Aug 2019, 02:05 PM
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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 08 Aug 2019, 03:00 PM

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.

0
Vladimir Stoyanov
Telerik team
answered on 09 Aug 2019, 02:52 PM
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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 13 Aug 2019, 01:42 PM

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.

0
Dilyan Traykov
Telerik team
answered on 14 Aug 2019, 02:04 PM
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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 16 Aug 2019, 02:20 PM

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.

0
Dilyan Traykov
Telerik team
answered on 19 Aug 2019, 03:19 PM
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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 21 Aug 2019, 12:58 PM

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.

0
Dilyan Traykov
Telerik team
answered on 22 Aug 2019, 09:08 AM

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.
0
Valentin
Top achievements
Rank 1
Iron
Iron
answered on 23 Oct 2019, 02:21 PM

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 !

Tags
TreeListView
Asked by
Valentin
Top achievements
Rank 1
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Valentin
Top achievements
Rank 1
Iron
Iron
Vladimir Stoyanov
Telerik team
Share this question
or