|
Rank: Member Groups: Member
Joined: 1/6/2016 Posts: 19
|
Hi,
I am trying to modify the context menu, in which I am adding a menuitem, and trying to bind it to a user defined command.
Public ICommand testcommand; public int testmenuId public ViewModel() { testcommand = new ActionCommand(testfunction); testmenuId = CommandIds.RegisterUserCommand(testcommand); } public void testfunction() { ................... }
but I It never hits the testfunction.I have also tried
testmenuId = CommandIds.RegisterUserCommand("testcommand"); but there was no result. Can you plesae help me getting this done.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
Hi,
RegisterUserCommand only gives you a command ID. You still need to handle BeforeContextMenu event to add a menu item that triggers that ID.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 1/6/2016 Posts: 19
|
I have added the CommandId to the Context menu as below
e.Menu.Items.Add(new EO.WebBrowser.MenuItem("Test Menu item", testmenuId );. It is showing up in the context menu, but when selected/clicked, nothing happens
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
You also need to handle the WebView's Command event. No where in the documentation that tells you you can use use an ActionCommand object with RegisterUserCommand. So you can't just pull it out of your head and expect it to work. See here for more information on how to handle command: http://www.essentialobjects.com/doc/webbrowser/customize/hot_key.aspxThanks!
|
|