Hi,
Click events are raised only by the Diagram / DiagramDocument classes. If they were raised by individual links, you would lose the event handler bindings after loading a diagram file and would need to reattach them to newly loaded links. If you'd like separate click methods called for specific type of links, e.g. inherited classes or having specific Id/Tag values, you could use the diagram.LinkClicked handler only as a dispatcher calling them:
void MyLinkClicked(object sender, LinkEventArgs e)
{
}
void AssociationClicked(object sender, LinkEventArgs e)
{
}
private void diagram_LinkClicked(object sender, LinkEventArgs e)
{
var link = e.Link;
if (link is MyLink)
MyLinkClicked(sender, e);
if ("Association".Equals(link.Tag))
AssociationClicked(sender, e);
}
If you really need per-instance event handler bindings, you could keep them in a Dictionary<DiagramLink, EventHandler<LinkEventArgs>> and call associated handlers for each link from diagram's handler.
Or if you define a custom link class, you could define Click event there and call MyLink.RaiseClick(...) from diagram's handler. In both last two scenarios you will have to take care of rebinding links to handlers after calling LoadFromFile/Xml methods though.
I hope that helps,
Stoyan