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,
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,
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,