GoWPF 3.0.3 - Cant zoom out

Hi, i am using a diagram the with following XAML code:

When i open the application my diagram gets shown the following way:

Everything is centered and this is the way i want it to have when i open it.
When i zoom in via CTRL + Mouse Wheel Up, it zooms in and scrollbars are shown.

Problem is, when i then want to zoom out via CTRL + Mouse Wheel Down, i would have expected, that it zooms out again. - Instead it just scrolls down the vertical scrollbar and then nothing more happens.

I already tried to read the documentation and player arround with the following dependency properties:
Stretch=“None”
HorizontalContentAlignment=“Center”
VerticalContentAlignment=“Center”
HorizontalAlignment=“Center”
VerticalAlignment=“Center”

No matter how i set them, i cant get it the way to behave as i wanted it to behave.
It seems, that on a certain point, when scrollbars apprea, the zooming behavior is broken.

How do i want it to behave?

  • When opened i want the layout to be centered with a padding of 25
  • Left mouse down + Mouse move should drag arround the whole diagram
  • Ctrl + Mouse wheel up/down should zoom in and out the diagram in relation to the mouse location
  • Mouse wheel up/down should scroll up/down the vertical scrollbar if there is one present

Can you assist me how i can achieve this behaviour? - Maybe it is simply bugged, or i am using it wrong,i am not sure.
The documentation also states that i should be able to zoom in/zoomout via CTRL + “+”/"-" key gesture which also does not seem to work.

Many thanks meanwhile, Hannes

I believe the behavior that you want is in fact the default behavior. Try it in the various pre-built samples.

Are you sure that the mouse is in viewport/diagram when you are generating mouse wheel events?

I can see in the samples, that it is working. - When i moreless copy the sample, and try to work with MVVM and put the go:Diagram within a DataTemplate for a viewmodel, it does not work anymore.

Looking at the implementations of CommandHandler.CanDecreaseZoom and CanIncreaseZoom – they look identical except for how they use the CommandHnadler.ZoomFactor because the zoom factor should be different when zooming out than when zooming in.

The same goes for the implementations of CommandHandler.DecreaseZoom and IncreaseZoom. So I don’t think there’s anything wrong with the CommandHandler.

It also seems unlikely that the mouse wheel events aren’t getting to the Diagram control. But you can check whether you fiddle with either the CommandBindings or the InputBindings. Here’s how the CommandHandler sets those up:

      diagram.CommandBindings.Add(new CommandBinding(Commands.DecreaseZoom, (s,e) => DecreaseZoom(e.Parameter), (s,e) => e.CanExecute=CanDecreaseZoom(e.Parameter)));  // AllowZoom
      diagram.InputBindings.Add(new InputBinding(Commands.DecreaseZoom, new KeyGesture(Key.OemMinus, ModifierKeys.Control)));
      diagram.CommandBindings.Add(new CommandBinding(Commands.IncreaseZoom, (s,e) => IncreaseZoom(e.Parameter), (s,e) => e.CanExecute=CanIncreaseZoom(e.Parameter)));  // AllowZoom
      diagram.InputBindings.Add(new InputBinding(Commands.IncreaseZoom, new KeyGesture(Key.OemPlus, ModifierKeys.Control)));

So I really cannot explain the problem.

Thank you Walter for your assistance. - I created a new application and was able to identify the problem.
The problem was raised by DevExpress UI framework i am using for dock windows.

For other guys out there, the following link shows a solution:
Themed LayoutPanel handles PreviewMouseWheel/MouseWheel event and doesn’t pass it to its content | DevExpress Support