Disabling Navigation Flicks in WPF
- by Brian Genisio's House Of Bilz
I am currently working on a multi-touch application using WPF. One thing that has been irritating me with this development is an automatic navigation forward/back command that is bound to forward and backwards flicks. Many of my touch-based interactions were being thwarted by gestures picked up by WPF as navigation. I just wanted to disable this behavior. My programmatic back/forward calls are not affected by this change, which is nice. Here is how I did it: In my main window, I added the following command bindings:<NavigationWindow.CommandBindings>
<CommandBinding Command="NavigationCommands.BrowseBack" Executed="DoNothing" />
<CommandBinding Command="NavigationCommands.BrowseForward" Executed="DoNothing" />
</NavigationWindow.CommandBindings>
Then, the DoNothing method in the code-behind does nothing:private void DoNothing(object sender, ExecutedRoutedEventArgs e) { }
There may be a better way to do this, but I haven’t found one.