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

Handling of Paste Command

9 Answers 327 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Uli
Top achievements
Rank 1
Uli asked on 01 Aug 2011, 02:24 PM
Hi,

I implemented my own paste handling. Therefore I set the property RadGridView.ClipboardPasteMode to GridViewClipboardPasteMode.None. This worked perfectly for version Q3 2010. Now I update to Q2 2011. With this version my handlers of the command ApplicationCommands.Paste are not invoked any more. I noticed that now the method GridViewDataControl.PasteCanExecute contains the statemente: e.Handled = true. I think this does not make sense for GridViewClipboardPasteMode.None.

Is this a known issue? Will it be fixed? Is there a workaround?

Best regards

Uli

9 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 05 Aug 2011, 09:06 AM
Hello Uli,

Sorry for the late reply.

The problem comes from the fact that RadGridView handles KeyDown event (ctrl + v) when any RadGridView command is performed and therefore Application.Paste command is not invoked. You can take a look this blog post for more information how to customize keyboard behavior.

Let me know if this doesn't help.

Best wishes,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Uli
Top achievements
Rank 1
answered on 05 Aug 2011, 11:39 AM
Hello Nedyalko,

the problem has nothing to do with key handling. There is the same behavior if I invoke the Application.Paste command via menu or toolbar. I am quite sure that the problem comes from the change in the implementation of the method GridViewDataControl.PasteCanExecute.

Regards Uli
0
Nedyalko Nikolov
Telerik team
answered on 10 Aug 2011, 12:06 PM
Hi Uli,

Could you please try your scenario with our latest internal build (2011.2.0808) and let me know how it works?

Best wishes,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Uli
Top achievements
Rank 1
answered on 10 Aug 2011, 02:49 PM
Hello Nedyalko,

it's the same behaviour with the 2011.2.0808 build.

Best regards

Uli
0
Nedyalko Nikolov
Telerik team
answered on 11 Aug 2011, 07:08 AM
Hi Uli,

I'm attaching a sample project which can give you an idea how to achieve the desired behavior with our latest internal build.
Let me know if there is something unclear.

All the best,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Uli
Top achievements
Rank 1
answered on 11 Aug 2011, 08:39 AM
Hi Nedyalko,

I'm sorry, but the solution you demonstated in your sample is not acceptable for our application. We can't use a custom command but we have to use the predefined ApplicationCommands.Paste because this is supported by all standard controls. We just want that when RadGridView.ClipboardPasteMode is set to GridViewClipboardPasteMode.None that the GridView ignores this command. Just the way it has been implemented in release Q3 2010.

Best regards

Uli
0
Nedyalko Nikolov
Telerik team
answered on 16 Aug 2011, 12:17 PM
Hi Uli,

Could you please send me a code snippet that demonstrates how you are using ApplicationCommands.Paste in your code?
Thank you in advance.

Best wishes,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Uli
Top achievements
Rank 1
answered on 16 Aug 2011, 02:15 PM
Hi Nedyalko,

in the menu of the main window I have a MenuItem bound to ApplicationCommands.Paste:
<MenuItem Header="Paste" Command="ApplicationCommands.Paste">

In the constructor of the UserControl that contains the RadGridView instance I set the ClipboardPasteMode property to GridViewClipboardPasteMode.None and add a binding to the Paste command.

<P>       
public
MyListView()<BR>       
{<BR>           
InitializeComponent();</P>
<P>           
RadGridView1.ClipboardPasteMode =
GridViewClipboardPasteMode.None;<BR>           
CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, ExecutePaste,
CanExecutePaste));<BR>        }</P>
<P>        private void ExecutePaste(object
sender, ExecutedRoutedEventArgs e)<BR>       
{<BR>            // ...
my paste code<BR>        }<BR></P>

 

If the keyboard focus is within the RadGridView I expect that the handler ExecutePaste is called as it has been in release Q3 2010.

Best regards
Uli

 

 

 

 

 



0
Nedyalko Nikolov
Telerik team
answered on 19 Aug 2011, 02:47 PM
Hi Uli,

The issue will be fixed with the next latest internal build (Monday - 22 Aug).
Sorry for the inconvenience caused.

P.S. I've updated your Telerik points accordingly.

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
GridView
Asked by
Uli
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Uli
Top achievements
Rank 1
Share this question
or