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

Disable copy functionality in TreeListView

2 Answers 57 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Larry asked on 09 Mar 2012, 08:07 PM
When I select an item in a RadTreeListView, press CTRL+C to copy, and paste into notepad, the results suggest to me that what the control is actually doing is calling the list item's ToString() method and placing the string result on the clipboard. The objects we display in our list view do not override ToString(), so the copied result is the return value from Object.ToString(), which is the name of the type.

Since we can't come up with a useful string representation of the objects we display, we'd rather just disable the copy operation, rather than have it put some not-very-useful string on the clipboard. Is there a way to do this?

Thanks,
Larry

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 12 Mar 2012, 08:31 AM
Hello Larry,

You can cancel Copying event of the grid like so:

private void clubsGrid_Copying(object sender, Telerik.Windows.Controls.GridViewClipboardEventArgs e)
        {
            e.Cancel = true;
        }

All the best,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Larry
Top achievements
Rank 1
answered on 12 Mar 2012, 04:53 PM
Thank you!
Tags
TreeListView
Asked by
Larry
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Larry
Top achievements
Rank 1
Share this question
or