Hi
I’ve been going through the help documentation and I see that Part has an Adornments property. I’ve also looked at the MakeAdornment and SetAdornment methods for adding adornments to a part. I couldn’t find much documentation on how to properly use adornments so I had to use Reflector to try and understand how to add and use adornments.
The problem I’m having is that I can successfully add an adornment to a part but if the part is moved the adornment’s location is not updated accordingly.
This is the initial state of the part with the adornment added:
And here is what it looks like after I’ve moved the part:
How can I get the adornment’s location to remain relative to the part’s location?
From looking at Reflector I can’t see anything specific happening in terms of the adornment’s location other than setting the adornment’s initial location.
Here’s the code I’m using to add the adornment:
var part = diagram.Diagram.PartManager.FindNodeForData(node, diagram.Diagram.Model);
var x = part.MakeAdornment(part.SelectionElement, (DataTemplate)Sys.Application.Current.Resources[“TestA”]);
x.Category = “TestA”;
x.LocationSpot = Northwoods.GoXam.Spot.BottomRight;
x.Location = part.GetElementPoint(part.SelectionElement, Northwoods.GoXam.Spot.Center);
part.SetAdornment(“TestA”, x);
Thanks
Justin