How to: Respond to Changes in a UML Model
It is possible to write code that is executed whenever a change occurs in a UML model in Visual Studio. It will respond equally to changes that are made directly by the user, and by other Visual Studio extensions. To see which versions of Visual Studio support UML models, see Version support for architecture and modeling tools.
These techniques are unsupported by the UML API. They might not work in future versions of Visual Studio.
Sample code is available at UML: Responding to Changes in a UML Model by using Events and Rules