Question

Changing the default behavior of ZoomContentControl to zoom on scroll

Posted 3 years ago by Avatar zeta8

Hi,

 

What would be the easiest way to change the default behavior of the ZoomContentControl to zoom in on scrolling of the mouse wheel? Currently, scrolling just enables the image to move up/down.

 

thx!


Comments (6)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Hello,

Right now the default input bindings (ZoomContentControl.InputBindings) get set up to do scrolling on mouse wheel.  You would need to remove the MouseWheelGesture items that don't have modifiers and then add something like this:

control.InputBindings.Add(new CustomInputBinding(ZoomContentControlCommands.ZoomInToPoint,
	new MouseWheelGesture(MouseWheelAction.PositiveDelta)));
control.InputBindings.Add(new CustomInputBinding(ZoomContentControlCommands.ZoomOutFromPoint,
	new MouseWheelGesture(MouseWheelAction.NegativeDelta)));

Actipro Software Support
Posted 3 years ago by zeta8

Thanks! I guess i'm missing something really basic, but i can't seem to be able to make the following declaration: 

 

ZoomContentControl.CustomInputBinding binding = new ZoomContentControl.CustomInputBinding();

I get Error 1 'ActiproSoftware.Windows.Controls.Navigation.ZoomContentControl.CustomInputBinding' is inaccessible due to its protection level 

Any suggestions? thanks!!

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Sorry, it appears that was an internal class.  I believe you can just rename the CustomInputBinding to InputBinding and have it work.


Actipro Software Support
Posted 3 years ago by zeta8

super, works like a charm! thank you! I didn't bother clearing any of the MouseWheelGesture items that don't have modifiers (still a newbie to WPF, so figuring how things work, excuse my lack of knowledge!)...but is there any reason why i should bother doing that given that it is working anyways?

 

thanks!

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

I believe that part is a portion of core WPF, so I'm not positive but it could be that both actions are occurring if you leave the old ones in.  Or it might just be taking one of the two.  If it's working then you are probably ok.


Actipro Software Support
Posted 3 years ago by zeta8

thanks very much!

Information The latest build of this product (2017.2 build 0664) was released 5 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.