Zooming questions

Hi,



I don’t know how to implement some funtionality:

I have model with different types of nodes. I use templates to set behaviour and look for them. There is also a zoom functionality on my go diagram. But I need to set one type of object not-zoomable. I mean that if there are some rectangles that are zoomed in/out and some dots which always should have the same size visible for user.

If you will get zoom 2.0 instead of 10x10 object I need set it 20x20 which give me that user still see the same size regardless of zoom.

But I don’t know where should I attach to get information that zoom diagram.Panel.Scale has been changed.

Are these rectangles elements that are supposed to be in the visual tree of each Node? In other words, do they move around with the node, are they deleted when the node is deleted, are they copied when the node is copied?

The DiagramPanel.Scale property is implemented via a transform on everything in the diagram. So you are going to have to change their sizes according to the scale value.

You can do that in a DiagramPanel.ViewportBoundsChanged event handler. Remember to establish the event handler after the Diagram’s ControlTemplate has been applied, which is normally done in a Diagram.TemplateApplied event handler.