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

Pasting issue in Diagram

1 Answer 52 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Yogendra
Top achievements
Rank 1
Yogendra asked on 10 Mar 2014, 12:38 PM
Hello,

When I am pasting anything in the diagram, it get pasted. For instance, if I copy some text from 'Notepad' and paste it in diagram, it create anew diagram shape and insert it into the diagram. I need to prevent this operation, can you please suggest something?

1 Answer, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 13 Mar 2014, 04:07 PM
Hello Yogendra,

In order to deny the Paste command in the RadDiagram you can remove it from the input bindings collection from code-behind (after the InitializeComponent() method) like so:

CommandManager.GetInputBindings(this.xDiagram).Remove(CommandManager.GetInputBindings(this.xDiagram).Where(i => i.Command == DiagramCommands.Paste).FirstOrDefault());

The drawback of this approach is that you will disable the whole paste capabilities ( Ctrl + V) of the RadDiagram and you won't be able to paste even shapes from inside the RadDiagram.

However if you need to be able to paste we will need you to elaborate more on your scenario.

I hope this helps you.

Regards,
Boris Penev
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
Diagram
Asked by
Yogendra
Top achievements
Rank 1
Answers by
Boris
Telerik team
Share this question
or