Deactivating keyboard shortcuts

4 posts, 1 answers
  1. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 23 Aug 2013 Link to this post

    Hi,

    Is it possible to deactivate keyboard shortcuts or activate selective commands such as only activated ctrl+A to select all. I would like a user to have restricted access. I could control using AllowCopy and AllowPaste but I could not disable the duplicate that can be performed using Ctrl+D. It throws an exception about but being able to create an instance of an Interface (My Diagram Items).

    Had a look under: http://www.telerik.com/help/silverlight/raddiagrams-features-shortcuts.html

    I cannot access - Diagram.InputBindings

    It just isn't there now.

    Any help would be appreciated.

    Cheers!
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 27 Aug 2013 Link to this post

    Hi Deepak,

    Can you please try to access the collection just after the InitializeComponent() method of your application. You should be able to access and clear that collection in order to disable the keyboard support.

    Basically you can use the following code:

    public MainPage()
    {
        InitializeComponent();
        CommandManager.GetInputBindings(xDiagram).Clear();
    }
    Please give this approach a try and let us know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 27 Aug 2013 Link to this post

    Hi Pavel,

    The code works but it takes away all the commands including 'Delete' which I need. Is there a way to add/remove only specific keyboard shortcut commands?
  5. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 27 Aug 2013 Link to this post

    Hi Pavel,

    Thanks for your help.


    var duplicateCommand = (CommandManager.GetInputBindings(TDiagram).Where(b => b.Command == DiagramCommands.Duplicate)).FirstOrDefault();          
     
    CommandManager.GetInputBindings(TDiagram).Remove(duplicateCommand);

    Cheers!
Back to Top