Add additional InputBinding in XAML

Mar 28, 2012 at 1:21 PM
Edited Mar 28, 2012 at 1:22 PM

This is more a WPF / XAML questions, but arose in the Helix Toollkit context:

Earlier versions of the HelixView3D had both the Shift+RightClick and the MiddleClick bound to the Pan command. The default template in the current version sets the PanGesture to Shift+RightClick, but MiddleClick no longer works. I want to keep the Shift+RightClick, and add the MiddleClick as an additional gesture, which means I can't just set the PanGesture property (it would replace the current gesture).

From code-behind it works if I do this:


sceneView3D.Loaded += delegate
            new InputBinding(CameraController.PanCommand,
                            new MouseGesture(MouseAction.MiddleClick)));


But I'd rather set it in the XAML, so I've tried something like this:

<helix:HelixViewport3D x:Name="sceneView3D" ... >
    <MouseBinding MouseAction="MiddleClick" Command="{x:Static helix:CameraController.PanCommand}"/>


but it doesn't work - we need to add to the CameraController's InputBindings.

Is it possible to add the InputGesture from XAML?

Thanks for the help,

Apr 3, 2012 at 12:20 AM

I added an alternative pan gesture dependency property (PanGesture2), and set the default value to the middle button.

That was the easy solution, not sure how to get the inputbindings to work..