Disable only vertical scrolling of Diagram

Hi,

I added some nodes & link objects in my diagram’ model with some specified location.
But when I scroll by mouse, then whole view is scrolled vertically, which I don’t need.

So how can I disable only vertical scrolling of diagram?

Note:
But horizontal scrollbar should work, as expected.

<go:Diagram.DefaultTool> <go:ToolManager WheelBehavior="None" /> </go:Diagram.DefaultTool>
You also need to replace the standard ControlTemplate provided for Diagrams, to customize the ScrollViewer and DiagramPanel:

<go:Diagram.Template> <ControlTemplate> <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"> <go:DiagramPanel x:Name="Panel" Stretch="None" Padding="{TemplateBinding Padding}" CanHorizontallyScroll="True" CanVerticallyScroll="False" AutoScrollRegion="0 0 0 0" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> </ScrollViewer> </Border> </ControlTemplate> </go:Diagram.Template>
Note that besides setting the obvious properties dealing with scrollbars and scrolling I also disabled autoscrolling.

Hi,

Thanks for your previous reply.

But no need to replace the standard ControlTemplate provided for Diagrams, to customize the ScrollViewer and DiagramPanel, as you mentioned.

The following code is still enough:

go:Diagram.DefaultTool
<go:ToolManager WheelBehavior=“None” />
</go:Diagram.DefaultTool>

Thanks

If you don’t change the default ScrollViewer, the user is still going to see a vertical scrollbar and be able to scroll vertically.

But if that is what you want, that’s OK then.