I have a small application that uses a navigation window and a set of pages. My application is not a browser per se and thus I dont want the user to be able to refresh the page by pressing F5. Is there a way to disable this key in my application? Many thanks all.
Can the F5 key be disabled in a navigation window in WPF?
3.3k views Asked by Edgar At
2
There are 2 answers
0
On
You can try to remove the CommandBinding from the NavigationWindow. NavigationCommand.Refresh
Something like:
CommandBinding removeBinding=null;
foreach(CommandBinding cb in navigationWindow.CommandBindings){
if(cb.Command==NavigationCommand.Refresh){
removeBinding=cb;
break;
}
if(removeBinding != null){
navigationWindow.CommandBindings.Remove(removeBinding);
}
}
You could disable refreshing altogether, by attaching a handler to the
Navigating
event: