Shortcut not working when I edit a cell

Hi,

I have a Treegird with MenuFlyoutItem. I have keyboard accelerators (shortcut) for each menu item. When I enter in edit mode on a cell of the treeegrid, some shortcuts don't work (CTRL + Q, CTRL + Y, CTRL + DEL). I suppose cell already contains base shortcut (like copy, pase, cut,...), it's why the event 

ProcessKeyboardAccelerators of the treegrid doesn't fire. 

How can I use shortcut like CTRL+Q when I edit a cell? For your information, all shortcut work well when cell is not in edit mode.

Regards,


5 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team September 17, 2021 03:15 PM UTC

Hi Daniel Garcia,

Thank you for contacting Syncfusion Support.

Based on provided information we have checked the reported issue “Shortcut not working when I edit a cell in SfTreeGrid” and unable to replicate the issue from our end. It is working fine as expected. Please find the tested sample and video demo from our end in the link below,

 
 
Can you please share us below things?         
        1. Provide the replication procedure with video illustration of the reported issue
 
if you are still facing the same issue? If yes, please modify the sample based on your scenario.

It will be helpful for us to check on it and provide you the solution at the earliest. 

Regards, 
Vijayarasan S 
  
  



DG Daniel Garcia September 20, 2021 07:33 AM UTC

Hi Vijayarasan Sivanandham,


Thank you for your help. I can produce my issue based on your demo.


I just added the ProcessKeyboardAccelerators:

 <syncfusion:SfTreeGrid x:Name="treeGridComponents"

                                   ItemsSource="{Binding Employees}"

                                   AutoGenerateColumns="False"

                                   AutoExpandMode="AllNodesExpanded"

                                   ParentPropertyName="ID"

                                   ChildPropertyName="ReportsTo"

                                   SelfRelationRootValue="-1"

                                   ExpanderColumn="FirstName"

                                   AllowEditing="True"

                                   ProcessKeyboardAccelerators="treeGridComponents_ProcessKeyboardAccelerators"

                                  >

Then I implemented the method:

private void treeGridComponents_ProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args)

        {

            if(args.Modifiers == VirtualKeyModifiers.Control)

            {

                Debug.WriteLine(args.Modifiers + " + " + args.Key);

            }

        }


When I use shortcut CTRL + Q and CTRL + Y in a edition mode, i can notice that ProcessKeyboardAcceleratorEventArgs is not fired.


Can you try this and confirm the issue is real please?


Regards,


Attachment: Sample113327411modified_c47049a0.zip


MA Mohanram Anbukkarasu Syncfusion Team September 21, 2021 07:44 AM UTC

HI Daniel, 

Thanks for the update.  

We have checked the provided sample. To achieve your requirement you have to hook the ProcessKeyboardAccelerators for the TextBox inside the cell which is used as edit element by creating custom renderer as shown in the following code example.  

Code example :  

public sealed partial class MainPage : Page 
 { 
     public MainPage() 
     { 
         InitializeComponent(); 
 
         this.treeGridComponents.CellRenderers["TextBox"] = new TreeGridTextBoxCellRendererExt(); 
     } 
 } 
 
 public class TreeGridTextBoxCellRendererExt : TreeGridCellTextBoxRenderer 
 { 
     public override void OnInitializeEditElement(TreeDataColumnBase dataColumn, TextBox uiElement, object dataContext) 
     { 
         uiElement.ProcessKeyboardAccelerators += On_ProcessKeyboardAccelerators; 
 
         base.OnInitializeEditElement(dataColumn, uiElement, dataContext); 
 
     } 
 
     private void On_ProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args) 
     { 
         if (args.Modifiers == VirtualKeyModifiers.Control) 
         { 
             Debug.WriteLine(args.Modifiers + " + " + args.Key); 
         } 
     } 
 } 


Please let us know if you require further assistance from us.  

Regards, 
Mohanram A. 



Marked as answer

DG Daniel Garcia September 23, 2021 03:59 PM UTC

Hi,


Thank you for your help. 


Regards,



MA Mohanram Anbukkarasu Syncfusion Team September 24, 2021 04:14 AM UTC

Hi Daniel, 

Thanks for the update.  

Please let us know if you require any other assistance from us.  

Regards, 
Mohanram A. 


Loader.
Up arrow icon