I have an application with a listview. Each listview item is templated showing additional information . Basically each listview items contains one image and several values like timestamps, string, ints.
The listview can be filtered using radDataFilter, and I want to be able to select an item in the listview, copy the item (I use my own clipboard format), go into the filter and then paste one of the copied values from my custom formattet content in the clipboard. I want to prompt the user with a dialog to choose with exact information to actually paste from the clipboard. And the content of clipboard should remain after the radDataFilter pasing.
My first approch to this has been to do it like this (simplified code):
private
void
filter_EditorCreated(
object
sender, Telerik.Windows.Controls.Data.DataFilter.EditorCreatedEventArgs e)
{
DataObject.AddPastingHandler(e.Editor,
new
DataObjectPastingEventHandler(CheckPasteFormat));
}
public
void
CheckPasteFormat(
object
sender, DataObjectPastingEventArgs e)
{
PasteWindow win =
new
PasteWindow();
win.ShowDialog();
// Modal dialog
string
result = win.Value.ToString();
DataObject d =
new
DataObject();
d.SetData(DataFormats.Text, result);
e.DataObject = d;
}
The problem with this solution is that showing a new window or as test just call MessageBox.Show gives an error:
Cannot perform this operation while dispatcher processing is suspended.
I have found a solution to this using Dispather.BeginInvoke but this has another problem with the folowing part updating the DataObject due to it is asynchroniously. There might be solutions to this also, but it gives me a feeling of a lot of hacks to make it work
So my next approach (and maybee more correct solution) would be to define a new "Paste special" command/functionality to handle my special pasting inside editor. Actually kind of the same way as Word, Excell etc does it, Im not very familiar with commands and stuff like that. Can you tell me if it is possible to add/append a "paste special" command with keyboard shortcut to the radDataFilter editors. It should also be available using the right-click menu in the radDataFilter editors.
Hopefully the "Speciel paste" will support undo etc, and clipboard content should not be changed using the "Speciel paste".
Hopefully you will be able to help me with this one.