Pasting issue in Diagram

2 posts, 0 answers
  1. Yogendra
    Yogendra avatar
    17 posts
    Member since:
    Aug 2013

    Posted 10 Mar 2014 Link to this post


    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?
  2. Boris
    Boris avatar
    276 posts

    Posted 13 Mar 2014 Link to this post

    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.

    Boris Penev

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

Back to Top