Custom Link Objects?

Here is my problem: I am using a custom node class derived from GoNode. This class contains two custom port which are classes derived from GoPort. So far so good. Users are restricted to creating links by the basic drag and drop from one port to another on the GoView. This works fine, except the concrete type of the link which is created is a GoLink or GoLabeledLink. By handling the linkCreated event I can customize the look & feel of the link, no problem. What I need to do is have an instance of a custom link class instantiated when the user creates a link.

For example, when a user creates a link I need it to be of type XLink. So when the user drags one port to another to create a link, in the event handler, I want to recast the GoObject property from the event arguments to an XLink. This doesnt work, because the link object has already been instantiated before the LinkCreated event is fired. I can replace the link with a new link, but that sucks.
Is there a way to override the LinkCreated event? Or if I create a derived version of the GoView I can override CreateLink(). But, if I override this method, are there other things I need to be aware of, ie other methods I need to override? The documentation does not seem to hint at this. Then will I have to fire the OnLinkCreated event?
If I'm heading in the wrong direction by overriding CreatLink(), or if there is a better way to do this, please let me know. Otherwise, I'll follow up on this & let you all know how it goes.

No GoView method override is needed. Just set GoView.NewLinkPrototype to an instance of what you want GoView.CreateLink to copy as the new link.


I probably went a little overboard. I derived a class from GoView and overrode the CreateLink method. But ultimately all I did was ust the NewLinkPrototype property as you suggested.