Zoom in Overview and Diagram

Hi wanted to know if there is any way to zoom the OverView also zoom in on the Diagram applies, there is some event OverView detect the zoom?


By default the Overview ControlTemplate sets DiagramPanel.Stretch to “Uniform”, so the user cannot change the scale of that diagram (i.e. they cannot zoom in or out).

You could remove that property setting, to allow the user to zoom in and out. However when they do, it will not affect the position or scale of the Observed diagram.

I suppose one could implement some mechanism by which the user could cause the observed diagram to change scale. I would imagine that resizing the Overview.Box would be a good way to design that UX. However I do not believe we have any code implementing such an extension.

Currently I can zoom in on the Overview, there are some events to detect zoom on OverView?

Because I could zoom in the diagram in the event of Overview zoom, I mean?

The most general answer is to establish a DiagramPanel.ViewportBoundsChanged event handler, but you’d have to worry about not making changes to the observed diagram during initialization or during other changes (such as scrolling) by the user in the main diagram.

So it might be easier to override CommandHandler.IncreaseZoom and CommandHandler.DecreaseZoom and use an instance of this custom CommandHandler as the Overview.CommandHandler.

But I want to do that when you zoom on the Overview zoom in on the chart is generated.

Yes, that’s what I was suggesting. As the user scrolls the mouse wheel in the Overview, it calls the Overview’s CommandHandler’s two zooming methods. Your override could then redirect the calls to the observed Diagram’s CommandHandler, instead of try to do it in the Overview itself.

Hmmm, you might need to override CanIncreaseZoom and CanDecreaseZoom too, to just return the corresponding values from calling the corresponding methods on the main diagram.

Can you help me with a example?

  // This redefines mouse wheel and keyboard zoom commands to change
  // the Observed Diagram's Scale, rather than the Overview itself.
  public class OverviewCommandHandler : CommandHandler {
    public override bool CanDecreaseZoom(object param) {
      return ((Overview)this.Diagram).Observed.CommandHandler.CanDecreaseZoom(param);
    public override void DecreaseZoom(object param) {
    public override bool CanIncreaseZoom(object param) {
      return ((Overview)this.Diagram).Observed.CommandHandler.CanIncreaseZoom(param);
    public override void IncreaseZoom(object param) {
            <go:Overview x:Name="myOverview" . . .
                         Observed="{Binding ElementName=myDiagram}">
                <local:OverviewCommandHandler />
                <go:ToolManager WheelBehavior="Zooms" />
            . . .