views:

32

answers:

1

Hi I wanted to change default textbox context menu, so I created my own menu and them I assigned it like that

texbox.ContextMenu = myContextMenu

However I don't know how to restore default textbox menu (in a runtime). I need myContextMenu to show only when I click textbox with right mouse button (while holding Control button). In other cases I need default textbox contextmenu to show. Is it possible ??

A: 

It would actually be more difficult to do than it would first seem. I believe that the default context menu is part of the actual template of the control.

The simplest approach, if you only want Cut/Copy/Paste, is to create a second ContextMenu implementing those options. If you do, you can use the built in ApplicationCommands to implement not only the functionality, but also to automatically localize this ContextMenu.

Wonko the Sane
I try this, however maybe I can somehow copy default menu to separate object ? Maybe with xaml reader or sth?
Dante