Movable and selectable ports


currently I work with GoXam and have to implement movable (with mouse) and selectable ports. Is there a common way implementing this features?

Kind regards


The general answer is that you can implement whatever you want within any FrameworkElement in a Node. Typically if you include a Selector in your Node DataTemplate, the user will be able to select items within Nodes. This ability has nothing to do with GoXam – it’s just WPF or Silverlight. (BTW, what platform are you targeting?) Some of the samples, such as the Entity Relationship Diagram, demonstrate this – the user can select multiple rows within nodes.

Selection within a GoXam Diagram is limited to Parts (Nodes or Links). All of the commands and tools that involve selection operate on Parts. But you can implement your own commands and tools that operate on your own notions of selection within a Node. You’ll need to decide which Node(s) and which elements within them are affected by those commands and tools.

I’m not sure exactly what you want to do, but if you have a mode in which the user may move ports, and if ports are implemented in a manner that they could easily be moved within the Panel(s) that they are in, it would make sense to implement a DiagramTool that lets users move (and copy?) ports by dragging them. I suggest you look at the implementation of the SimpleLabelDraggingTool in the State Chart sample, which is similar in purpose and structure to what you want to do. But obviously it has different notions for positioning those items – labels that are arranged on a link route, instead of ports within a node panel.