Search code examples
wpfdotnetbrowser

Zooming on CTRL + Mousewheel in DotNetBrowser


I'm using the DotNetBrowser WPF control and need to set the Zoom level on a CTRL + MouseWheel event.

I've added the following code to my control, expecting e.Delta to give me the direction the mouse wheel is being moved. Having the CTRL key down prevents the underlying window from scrolling, so I figured I could control zoom by checking whether the delta was positive or negative.

BrowserView.PreviewMouseWheel += (s, e) =>
{
    Debug.WriteLine("Previewing event " + e.Delta);
};

However, when attached to the BrowserView, the Delta value is always 0. How can I determine what direction the mouse wheel is being moved so that I can apply a zoom level?


Solution

  • Turned out to be a bug in the PreviewMouseWheel event fixed in version 1.12

    https://dotnetbrowser.support.teamdev.com/support/discussions/topics/9000036763

    Using MouseWheel instead of PreviewMouseWheel also resolved the issue.