WPF How to disable NavigationWindow commands -


i use pages , navigationwindow:

navigationwindow = new navigationwindow();             navigationwindow.height = 200;             navigationwindow.width = 100;             navigationwindow.windowstate = windowstate.maximized;             page = new intropage();             navigationwindow.navigate(page);             navigationwindow.show(); 

i navigate using goback , goforward methods, don't want use them shortcuts (function buttons in mouse etc.) how can disable these shortcuts?

in navigation window xaml can add this:

<navigationwindow.inputbindings>     <keybinding key="back" command="notacommand" />     <keybinding key="next" command="notacommand" />     <keybinding key="browserback" command="notacommand" />     <keybinding key="browserforward" command="notacommand" />     <keybinding key="left" modifiers="alt" command="notacommand" />     <keybinding key="right" modifiers="alt" command="notacommand" /> </navigationwindow.inputbindings> 

in code same this:

navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.back, modifierkeys.none)); navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.next, modifierkeys.none)); navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.browserback, modifierkeys.none)); navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.browserforward, modifierkeys.none)); navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.left, modifierkeys.alt)); navigationwindow.inputbindings.add(new keybinding(applicationcommands.notacommand, key.right, modifierkeys.alt)); 

there other keys can prevented, such browserhome , browserrefresh well.

that prevents hotkeys, not mouse navigation if navigation ui being displayed. if want control navigation programmatically should hide navigation ui showsnavigationui="false" in xaml (as parameter of navigationwindow tag) or mainwindow.showsnavigationui = false; in code.

also, can prevent mousebindings same way have done above keybindings, adding new mousebinding objects mouseaction property set.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -