ZoomContentControl and panning

Navigation for WPF Forum

Posted 8 years ago by P. Chwoika - Inosoft GmbH
Version: 11.1.0541
Avatar
Hi there,

i've got a question concerning the actipro ZoomContentControl.

When I use the ZoomControl the panning of the content is activated by default.

I can deactivate the panning by pressing the 'Alt'-key.
Is there a way to remap this key?

Furthermore, I would need a slightly different behaviour of the ZoomControl. It would be great, if panning was deactivated by default and could then be activated by pressing a key.
Is there a way to do that?

Thanks in advance for your help :)


P. Chwoika

Comments (7)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The Custom Input Bindings QuickStart shows how you can customize the keyboard/mouse behaviors. You can also check out the documentation under "Actipro Navigation\ZoomContentControl Features\Input Bindings".


Actipro Software Support

Posted 8 years ago by P. Chwoika - Inosoft GmbH
Avatar
Hello,

thanks for your help.

Is it also possible to deactivate the panning of the ZoomContentControl by default?

[Modified at 05/26/2011 04:21 AM]
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The only way to disable it would be to not define any input bindings for actions that don't have an associated key down. For example, don't specify an input binding for LeftClick, but you can specify one for Ctrl+LeftClick.

That way the user can't use the left mouse button to navigate around without holding down the Control key.


Actipro Software Support

Posted 8 years ago by P. Chwoika - Inosoft GmbH
Avatar
Hello again!

I managed to change the panning behavior to my needs.
With the InputBindings I created the panning starts only when the alt key is pressed and the mouse is dragged.


I just noticed that pressing the Up/Down/Lef/Right Keys also starts panning. How can I disable that?


Thanks in advance for your help :)
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

Those keys are currently handled by the ScrollViewer used in the ZoomContentControl. You'd need to create a custom class that derives from ZoomContentControl to disable that behavior. Something like:
public class MyZoomContentControl : ZoomContentControl {
    protected override bool HandlesScrolling {
        get {
            return true;
        }
    }
}
Alternatively, you could handle the PreviewKeyDown event on the ZoomContentControl and set e.Handled to true when you see one of the arrow keys. This might cause some adverse side-effects on other controls in the ZoomContentControl though.


Actipro Software Support

Posted 8 years ago by P. Chwoika - Inosoft GmbH
Avatar
Thanks for your help.
The trick with the custom class that derives from ZoomContentControl worked for me.

I use this MouseBinding
<MouseBinding Command="{x:Static navigation:ZoomContentControlCommands.StartPanDrag}" Gesture="Alt+LeftClick" />
to start panning when the Alt-Key is pressed and the user drags his mouse.

Is there a way to change the alt key to the space bar key?
I need to start panning just like in Microsoft Expression Blend when the Space-Key is pressed.

Thanks for your help!
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

Unfortunately, no that is not supported by the native WPF mouse gestures. The only "modifier" keys supported are Control, Shift, and Alt. You may be able to override the OnKeyDown and OnKeyUp methods, then look for the space key. When you see it in OnKeyDown, you could add mouse bindings that don't use a modifier key. Then remove that binding in the subsequent OnKeyUp call.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.