1.2: Synchronizing selection in multiple controls

For version 1.2 we have extended the EntityRelationship Diagram sample by adding a ListBox of the entities shown in the diagram.

When the user selects an entity in the ListBox, the corresponding entity Node is selected.

When the user selects a Node, the corresponding item in the ListBox is selected.

Although one can implement this selection-synchronization using data-binding, in this sample it was implemented in code so that the mechanism will work when there are three or more controls that need to synchronize selection.

Furthermore when a Node is selected, the diagram automatically scrolls to bring it into view. (You’ll need to move the nodes farther apart, or zoom in, to see this effect; this auto-scroll to selection is really useful when the graph is much bigger.)