Have a RadListbox, in xaml have set (SelectionMode="Multiple").
Want the user able to copy a selected item(s) and paste it anywhere (text file, excel, etc.) having issue finding topics in forum that helps me complete the operation of "copy".
Is there a method to do this?
1 Answer, 1 is accepted
0
Accepted
Martin Ivanov
Telerik team
answered on 26 Dec 2019, 11:21 AM
Hello Herb,
RadListBox doesn't provide a built-in clipboard support. To achieve your requirement, you can subscribe to the KeyDown event of the listbox and implement a custom copy/paste logic that saves and loads data from the clipboard.
privatevoidRadListBox_KeyDown(object sender, KeyEventArgs e)
{
var selectedItems = this.listBox.SelectedItems;
if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.C)
{
// implement a copy logic that saves the selected items in the clipboard
}
elseif (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.V)
{
// implement a paste logic that loads the data from the clipboard
}
// you can use the Clipboard class to implement copy/paste operations// https://docs.microsoft.com/en-us/dotnet/api/system.windows.clipboard?view=netframework-4.8
}
I hope this helps.
Regards,
Martin Ivanov
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.