I want to have some object type like timer & error(see it in the picture)
If I drop it to an object in the view, it’ll attached to the object in the view.
If I drop it to the view, it’ll added to the view.
Here is the picture.
That link didn’t work for me.
You might want to look at what OrgCharter does to handle dropping a GraphNode onto another GraphNode. Look at the overrides of DoExternalDrop and OnSelectionMoved in the GraphView class.
Thanks you for your replying, I used DoExternalDrop and OnSelectionMoved function very well. I want after droped they’ll be come a couple like the picture in Yahoo!Photos.
I uploaded your photo, for everyone’s convenience.
Is the clock-like object what you called a timer? And you want it to move along with the UT_110… node when the user moves the node. If the user tries to move the timer, should the node move along too? Or is the timer not selectable?
The normal thing to do would be to add the timer object to the node. In this case they might be a GoImage added to a GoTextNode (I’m guessing here how you are implementing things). But it’s true that adding the timer to the node/group would mean that when the user deleted the node, the timer would disappear too.
You can make their lifetimes independent of each other in at least a couple of different manners. The most obvious thing would be to implement a GoView.SelectionDeleted event handler that noticed when a node with a timer was deleted. Then it would remove the timer from the node and add it back to the document as a top-level object.
Alternatively, you can leave the timer and the node as top-level objects in the document. That way they could be deleted independently of each other, as you seem to require. For moving together you can implement and install a custom dragging tool, much like what TreeApp does. Basically that tool’s ComputeEffectiveSelection method would make sure that for any nodes that are in the selection it would also include their timers, and vice-versa (if desired).