Disable Diagram KeyBoard Interactions

Hi

How to disable Diagram KeyBoard Interactions?

thanks

Reagrds


1 Reply

AR Aravind Ravi Syncfusion Team December 13, 2021 01:15 PM UTC

Hi Salvatore, 

We have created a sample to modifying the existing commands. By using the commands property we can able to modify the existing commands in the diagram. When any one of the default commands is not desired, they can be disabled. To change the functionality of a specific command, the command can be completely modified. Please refer to code snippet and sample 

<SfDiagramComponent @ref="@diagram" Height="600px" Nodes="@nodes"> 
    @* Initializing the custom commands *@ 
    <CommandManager> 
        <CommandManager Commands="@commands" Execute="@CommandExecute" CanExecute="@Canexe"> 
        </CommandManager> 
    </CommandManager> 
</SfDiagramComponent> 


public void CommandExecute(CommandKeyArgs args) 
   
        if (args.Gesture.Modifiers == ModifierKeys.None && (args.Gesture.Key == Keys.ArrowUp || args.Gesture.Key == Keys.ArrowDown || args.Gesture.Key == Keys.ArrowRight 
            || args.Gesture.Key == Keys.ArrowLeft)) 
       
            //to disable a built-in command and none of action execute 
       
        if (args.Gesture.Modifiers == ModifierKeys.Control && (args.Gesture.Key == Keys.C || args.Gesture.Key == Keys.X || args.Gesture.Key == Keys.V)) 
       
            //to disable a built-in command and none of action execute 
        
   


For more information about how to modifying the existing the command, Please refer to below documentation link 


Regards 
Aravind Ravi 


Loader.
Up arrow icon