This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am reviewing the diagramming tools, and have a simple query about capabilities. I want to allow my users to easily create diagrams such as the one pictured - the includes the following features:
Is this possible with this product? Thanks |
|
|
Hello nimble Thanks for your interest in our diagramming framework Streams is not a standard built in feature, but you can use the available features to implement this yourself. I have attached a demo project to help get you started with this. To run the sample, make sure to include a reference to your copy of the Mindscape.WpfDiagramming.Foundation.dll. When you run the sample, you will see 3 streams like in the image you posted, and a toolbox on the left hand side of the diagram. If you drag the node from the toolbox over one of the streams, you will see it will become highlighted indicating you can add the node to the stream. When you drop a node into a stream, you will see the node is snapped into place. Adding more nodes will stack them on top of each other. You can also drag a node from one stream to another, or drag a node outside any of the streams. If you add multiple nodes to one stream and start creating a connection (mouse over a node and drag one of the points that appear) you will see you can not create a connection to a node in the same stream, but can connect to a node in a different stream. The size of the streams is also aware of the contained nodes - if you resize a node, the width or height of the streams can update if necessary. The easiest way to implement this support is to create a custom node to represent a stream (or SwimmingLane as I've called it), and also implement a node that can be added to a swimming lane node. The SwimmingLane and DataNode classes can be found in the Model folder, and the styles for these nodes are in the Styles/DiagramStyle.xaml file. There are various samples, documentation and blogs about the basics of how to implement custom nodes and apply styles to them. Let me know if you have any questions about this topic. 1) Dividing the surface into swimming lanes. In the MainWindow.xaml.cs constructor I create 3 instances of the SwimmingLane node and add them to the diagram. In your application, you can easily include logic to add or remove swimming lanes at runtime. In MainWindow.xaml.cs, there is a method called UpdateSwimmingLanesLayout which iterates through all the swimming lanes and lays them out side by side. (You can reposition or/and resize a node by setting the Bounds property). This method is called whenever a new swimming lane is added, or when the size of one of the lanes is changed (i.e. a node was added or resized). MainWindow.xaml.cs also includes the logic for listening to mouse drags and drops to add a node to a swimming lane. 2) Stacking multiple nodes. The SwimmingLane node keeps track of all the nodes that have been added to it. By listening to when a node is added or resized, the SwimmingLane.UpdateLayout method is called which runs a simple algorithm to stack each node on top of each other. 3) Connection validation logic. This kind of logic can be implemented in a custom IDiagramConnectionBuilder. You will see this in Model/ConnectionBuilder which contains 2 methods. CanCreateConnection is where you can implement connection validation logic. Here I check to see if the Parent of the source and destination nodes are the same to determine whether or not a connection is allowed to be made. The CreateConnection method simply creates the DiagramConnection instance and adds it to the given diagram model. This demo is using quite a few different features of the diagramming framework. Let me know if you need me to explain something or if you have any further questions about streams. Jason Fauchelle |
|