Changing the default behavior of ZoomContentControl to zoom on scroll

Navigation for WPF Forum

Posted 5 years ago by zeta8
Version: 14.1.0602
Avatar

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 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 5 years ago by zeta8
Avatar

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 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 5 years ago by zeta8
Avatar

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 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 5 years ago by zeta8
Avatar

thanks very much!

The latest build of this product (v2018.1 build 0675) 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.