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

No "AllowDuplicate" option

2 Answers 50 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 21 Nov 2013, 06:53 PM
The RadDiagram lets you turn off Cut, Copy, Paste, etc functionality, but there doesn't seem to be a way to turn off the Duplicate command.

How would I remove the Ctrl+D key binding from the RadDiagram?

Thanks

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 26 Nov 2013, 02:50 PM
Hi Terry,

In order to achieve your requirement you actually can predefine the duplicate command that has been executed on Ctrl+D combination. You can do this with the following snippet:

private static void CanExecuteDuplicate(object sender, CanExecuteRoutedEventArgs e)
{
    e.CanExecute = true;
}
 
private static void ExecuteDuplicate(object sender, ExecutedRoutedEventArgs e)
{
    return;
}
 
static MainWindow()
{
    var duplicate = new CommandBinding(DiagramCommands.Duplicate, ExecuteDuplicate, CanExecuteDuplicate);
    CommandManager.RegisterClassCommandBinding(typeof(RadDiagram), duplicate);
}
By doing so you will need to implement custom duplication logic inside the ExecuteDuplicate() method. Please note that this method will be invoked when the e.CanExecute is set to True, otherwise the default duplication logic will be triggered.

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 WPF.
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
Terry
Top achievements
Rank 1
answered on 26 Nov 2013, 11:32 PM
Thank you! That worked like a charm
Tags
Diagram
Asked by
Terry
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Terry
Top achievements
Rank 1
Share this question
or