Shows the effect of some different properties on Nodes and on Links. This sample supports dynamically changing a node's figure, "from" port spot, and "to" port spot, or a link's routing, curve, curviness, smoothness, "to" arrow, "from" arrow, and arrow scale properties. In addition, the To and FromShortLength properties can be manipulated in order to create offsets which eliminates intersection between the Route the Arrowheads.
Those properties on Nodes and Links are data-bound to properties in their respective data classes, MyNodeData and MyLinkData. For example, the go:NodePanel.Figure attached property on the node shape is bound in XAML as follows:
go:NodePanel.Figure="{Binding Path=Data.Figure}"
The Figure property is defined in the MyNodeData class as follows:
// The NodeFigure which is used in the NodeTemplate. public NodeFigure Figure { get { return _Figure; } set { if (_Figure != value) { NodeFigure old = _Figure; _Figure = value; RaisePropertyChanged("Figure", old, value); } } } private NodeFigure _Figure = NodeFigure.Actor;
In order to correctly update properties on a particular Node via its DataTemplate bindings, a call to the RaisePropertyChanged method is needed, but only when the value has actually changed. Furthermore, it needs to pass both the original and the new value, to support undo/redo functionality.
When you add properties to your data classes, if you expect those values to change dynamically, you'll need to implement properties in the manner shown above. However the Color and Thickness data properties of MyNodeData and MyLinkData are not expected to change after initialization in this sample -- thus they do not implement property-change notification.