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

Deactivating keyboard shortcuts

3 Answers 78 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Deepak Shakya
Top achievements
Rank 1
Deepak Shakya asked on 23 Aug 2013, 05:29 AM
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!

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 27 Aug 2013, 04:47 PM
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 >>
0
Deepak Shakya
Top achievements
Rank 1
answered on 28 Aug 2013, 01:44 AM
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?
0
Deepak Shakya
Top achievements
Rank 1
answered on 28 Aug 2013, 02:35 AM
Hi Pavel,

Thanks for your help.


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

Cheers!
Tags
Diagram
Asked by
Deepak Shakya
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Deepak Shakya
Top achievements
Rank 1
Share this question
or