ZoomContentControl: How to check if ZoomToFit Button was pressed?

Navigation for WPF Forum

Posted 6 years ago by michael keller
Version: 13.1.0581
Avatar

Hi there,

I am currently working on a problem, where I need to know if/when the user pressed the zoom-to-fit button. I didn't come to any solution on this one.

Can anyone help me with that?

Thank you 

Mike

Comments (2)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

You'd probably need to replace our command handler with one of your own.  Right now, it's:

CommandManager.RegisterClassCommandBinding(typeof(ZoomContentControl), 
  new CommandBinding(ZoomContentControlCommands.ZoomToFit, OnZoomToFitExecute));

And the handler is:

private static void OnZoomToFitExecute(object sender, ExecutedRoutedEventArgs e) {
	ZoomContentControl control = (ZoomContentControl)sender;
	if (e.Parameter is Orientation)
		control.ZoomToFit((Orientation)e.Parameter);
	else
		control.ZoomToFit();
	e.Handled = true;
}

If you make your own similar handler instead and register that in place of ours, you should be able to get notified.


Actipro Software Support

Posted 6 years ago by michael keller
Avatar

Thanks a lot!

That did the trick. Have it up 'n running like I wanted to.

Regards,

Mike

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

Add Comment

Please log in to a validated account to post comments.