Telerik blogs

Our upcoming 2010 Q2 version packs a lot of goodies. One of them is the totally revamped Clipboard support in RadGridView for WPF and Silverlight.

Made possible by cell selection which will also be introduced in Q2, the new and improved Clipboard capability is both robust, easy to use and very extensible. By default, users can both copy and paste cells. However, the RadGridView has two additional properties - ClipboardCopyMode and ClipboardPasteMode, which provide thorough control over Clipboard operations. You will be able to choose whether users can copy cells, column headers and/or column footers, or control how pasting works - skip the first and/or last lines (useful if the clipboard contents contain header or footer rows) and overwrite non-empty cells in the RadGridView if the incoming clipboard data contains empty cells (by default empty cells from the Clipboard won't clear RadGridView cells).

Four new events were added as well: Copying and Pasting, which allow you to cancel a copy or paste operation, and CopyingCellClipboardContent and PastingCellClipboardContent, which in turn allow you to cancel the operation on a per-cell basis and override the cell's value. Handling these events will allow you to copy and paste cells from columns with custom templates.

There are two more methods in GridViewColumn that you can override in your implementations: OnCopyingCellClipboardContent and OnPastingCellClipboardContent that act just like the RadGridView events of the same name.

Our goal was deep compatibility with Excel when it comes to pasting and we hope you will be delighted with the results. By default, the RadGridView will try to parse incoming values from Excel and create the appropriate data type specified in your model. Unless the format is very different, the RadGridView should convert the data successfully. You can provide more complex parsing logic in the new event handlers.

Just in case you've become bored with all this techno-babble, here's a demo! You can copy from one RadGridView to another, or from RadGridView to Excel and back again. Go on, try it. You know you want to.

Get Microsoft Silverlight

We'd love to hear some feedback from you in the comments below this post. Remember, devs can make you happy if you tell them how :)

P.S. This has been another showcase of our new absolutely yummy Transparent theme. You'll get to play with all these new and exciting features in two or three weeks, when the Q2 version of RadControls ships.

About the Author

Yavor Georgiev

Software Developer,
Telerik XAML Team

Related Posts


Comments are disabled in preview mode.