Scale the selected part in diagram

Hey Nwoods Team,

I was exploring the functionality similar to rubber band zoom. I’ve even checked the existing blogs for the same through which I got to know that DragZoomingTool.ZoomToRect will be best suite for my requirement as I will draw a rectangle or square through the mouse.
But, I am not able to get how will I get the rect coords which is drawn by mouse at runtime. like is there some control which i need to use on xaml side or create some button by which i’ll be able to bind the event or some command.
can you help me out, that how can I achieve it step by step from UI Diagram(XAML) to selected zoomed diagram?


I am still uncertain of what it is that you want to do. Your description does not seem to match the title of this forum topic.

DragZoomingTool.ZoomToRect is only called on a mouse-up event, by DoMouseUp, and it is passed a Rect in model coordinates. Are you asking about how to customize the behavior on mouse-moves? If so, DragZoomingTool.DoMouseMove does this:

    public override void DoMouseMove() {
      if (this.Active && this.Box != null) {
        Rect r = ComputeBoxBounds();
        FrameworkElement rect = this.Box.VisualElement;
        rect.Width = r.Width;
        rect.Height = r.Height;
        this.Box.Position = new Point(r.X, r.Y);

Hey Walter, just for your reference. Please visit this link “Band Zoom · GitHub” this kind of functionality I want to implement with GoXam (wpf) hope you are able to refer what I want to achieve.

That is exactly the purpose of the DragZoomingTool. Except that it’s a bit more sophisticated than what is demonstrated in the link that you gave.

Did you follow the instructions in the documentation for that class? GoXam for WPF 2.2.4

After implementing as per documentation it works like charm. Thanks a lot.

But as i side-effect or rather I say as per functionality, I am unable to select multiple nodes at a time as we have setted DragSelectingTool="{x:Null}".

So, I would like to disable and enable DragZoomingTool on a button click event. so that, DragSelction will be active for group operation on nodes. so I have two questions for you now.

  1. What value I should set for DragSelectingTool to let it start again for selection of elements ? (ex. “{x:Null}”)
  2. How can I enable and disable this DragZoomingTool ?

You can toggle the DiagramTool.MouseEnabled property in order to enable/disable individual tools.

Okay, thanks Walter.