This topic has not yet been rated - Rate this topic

NodeShape.OnAbsoluteBoundsChanged Method

Called when the size or location of the shape have changed.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)
public virtual void OnAbsoluteBoundsChanged(
	AbsoluteBoundsChangedEventArgs e
)

Parameters

e
Type: Microsoft.VisualStudio.Modeling.Diagrams.AbsoluteBoundsChangedEventArgs
An object that specifies the old and new absolute bounds.

Override this method in your shape class, to respond to a change of shape or location. This method will be called only if the old and new values are different. Make sure that you call [base.OnAbsoluteBoundsChanged(e)].

When to use this method

  • Use this method when you want to update values that are not in the Store – that is, they are not properties of the model or diagram elements. This method is always called after the bounding box changes, even when the user invokes the Undo command.

  • If you want to respond to the change by making another change inside the model or diagram – for example to adjust the position of neighboring shapes - create a ChangeRule to observe the AbsoluteBounds domain property in your shape class. In an Undo, all the in-store properties are reset by the Undo handler, and the change rule is not called. For more information, see the example in AbsoluteBoundsDomainPropertyId.

  • If you want to constrain the size or location of a shape, use BoundsRules.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ