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,
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,
It will be helpful for us to check on it and provide you the solution at the earliest.
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
|
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);
}
}
} |
Hi,
Thank you for your help.
Regards,
- 5 Replies
- 3 Participants
- Marked answer
-
DG Daniel Garcia
- Sep 16, 2021 03:56 PM UTC
- Sep 24, 2021 04:14 AM UTC