Geeks With Blogs

News Locations of visitors to this page
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:

    <CommandBinding Command="NavigationCommands.BrowseBack" Executed="DoNothing" />
    <CommandBinding Command="NavigationCommands.BrowseForward" Executed="DoNothing" />

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.

Posted on Wednesday, June 2, 2010 4:10 AM | Back to top

Comments on this post: Disabling Navigation Flicks in WPF

# re: Disabling Navigation Flicks in WPF
Requesting Gravatar...
Or in the constructor of your NavigationWindow:

NavigationCommands.BrowseBack.InputGestures.Clear(); NavigationCommands.BrowseForward.InputGestures.Clear();
Left by nitzzzu on Jun 07, 2010 12:40 AM

Your comment:
 (will show your gravatar)

Copyright © Brian Genisio's House Of Bilz | Powered by: