I have a TextBox in CellEdititngTemplate for DataGridTemplateColumn in my DataGrid and I want to show 4 context menu items (Cut, Copy, Paste, Select All) when my DatagridCell is in edit mode and user right-clicks on it.
I see that default right-click context menu for TextBox control contains only 3 menu items: Cut (Ctrl+X), Copy (Ctrl+C), Paste (Ctrl+V).
There's no 'Select All' context menu item though Ctrl+A works for TextBox. So the question is - how to add a new Context Menu item 'Select All' into TextBox context menu without loosing cut, copy, paste menu items and their functionality?
I don't think you can change existing context menu, but you can create yours and repeat other commands
<ContextMenu>
<MenuItem Command="ApplicationCommands.Cut" />
<MenuItem Command="ApplicationCommands.Copy" />
<MenuItem Command="ApplicationCommands.Paste" />
<MenuItem Command="ApplicationCommands.SelectAll" />
</ContextMenu>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With