Add additional InputBinding in XAML

Anonymous 9 years ago 0
This discussion was imported from CodePlex

govert wrote at 2012-03-28 14:21:

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,

objo wrote at 2012-04-03 01:20:

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..