Different adorners for different shapes

Hi,

We’re trying to implement custom adorners for our shapes (nodes).
For each node, we intend to have a different shape, each with its own specific adorner template and behavior.
An example of this would be what we currently have in Visio or Powerpoint.
I went ahead and attached 2 different specific adorners.
On these attached images, note that there are yellow diamond icon(s) which can be moved to affect the presentation of that particular shape. Note that each shape might have a different amount of these diamond icons.
The rectangle’s rounded corners change following the drag of this diamond icon.
What would be the best approach to this? I’m thinking to put up a bunch of data template resources, which can be loaded dynamically by the presenter on the main NodeSelectionAdornmentTemplate. That should take care of the UI. However, how about the behavior handling of these extra icons? Which GoXam tools should I modify?
Thanks.

I assume you have seen the customized Adornment DataTemplates that are in the DraggableLink sample.

We haven’t yet implemented a NodeReshapingTool, inheriting from ReshapingBaseTool. It would do what you suggest. It would be responsible for dynamically creating the needed reshape handles and the dragging of those handles.

The tool’s UpdateAdornments method is responsible for creating or updating the tool handles used by that tool. If you look at the CustomRotatingTool in the DraggableLink sample, you can see how the typical simple UpdateAdornments method can be implemented. (It needed several overrides because the rotation handle is being placed at a different angle than the value of the Node.RotationAngle, say at -90 degrees instead of at zero degrees.)

You’ll need to override DoMouseMove and DoMouseUp to actually modify the adorned Node's data property corresponding to the current ReshapingBaseTool.Handle.

Did you search this forum and find the example I created for reshaping lines?
Free Form Arrows

Hi Walter,

I’m able to make it work. However, I’m having a problem when trying to determine who calls UpdateAdornments. It gets called several times during MouseMove, MouseUp and I think it gets called again at the end when tool is stopped. The call stack did not give me enough information.
Thanks.

What’s the problem? Is it not being called when you want it to be called?

The problem is that UpdateAdornments gets called many times by various callers.

Is there any way for us to tell who’s currently calling it from within the UpdateAdornments itself?
I noticed that we call it during DoMouseUp and then something else calls it again right after. I’m just wondering which events are responsible for those.
Thanks.

Well, it should be called often.
I don’t think there’s an easy way to tell why it’s being called.

If you are concerned about performance, you can see if the adornment already exists and just modify it.

I’ll try that. Thanks.

This is what I have tried. Looks good at this point.
Seems to still mess up when the shape and adorner have been rotated.
Thanks.