How to use mouse_wheel event to zoom the diagram

I try add mouse_wheel event but it can’t run.I think it stop routing when scrollviwer the what can i do??help me!thank you!

By default mouse-wheel events scroll the diagram up or down, shift-mouse-wheel events scroll the diagram left or right, and control-mouse-wheel events zoom in or out.

So you shouldn’t need to implement anything. Or do you want to do something different?

yeah,i know the control-mouse-wheel,but the default mouse-wheel and shift-mouse-wheel was disEnable in our project. we only need one rect to show the nodes and use diagram move to move the nodes. so if there is some method to solve the problem ,it ok!

You could customize the DoMouseWheel method of the Diagram.DefaultTool, which is normally an instance of ToolManager:

public class CustomToolManager : ToolManager { public override void DoMouseWheel() { . . . } }
Install with either:

    myDiagram.DefaultTool = new CustomToolManager();


<go:Diagram . . .> <go:Diagram.DefaultTool> <local:CustomToolManager /> </go:Diagram.DefaultTool> </go:Diagram>

oh,very thanks!!

In version 1.2 we have added a WheelBehavior enumerated type and a DiagramTool.WheelBehavior property.

So if you want to change the default mouse wheel behavior from scrolling to zooming, you can now set the WheelBehavior property on the Diagram.ToolManager. (The ToolManager is the default tool that is running most of the time.)

<go:Diagram . . .> <go:Diagram.DefaultTool> <go:ToolManager WheelBehavior="Zooms" /> </go:Diagram.DefaultTool> </go:Diagram>
The default value is WheelBehavior.Standard, which supports the behavior I described earlier in this topic.