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
|
Hi,
I've find out another issue. One of requirement of my application is connection validation, ie. node A can connect only with node B and node C can connect only with node D. Is this possible to implement this using your controls? Is this possible to have two connections on one diagram each having different look?
Regards, Peter |
|
|
Hello Peter For connection validation, start by reading through this blog post: http://www.mindscape.co.nz/blog/index.php/2010/04/13/wpf-diagramming-connection-and-an-api-change-validation/ It contains all you need to know to create your own connection validation logic and give it to the diagram to use. Let me know if there is something you don't understand or if you need more advice for particular validation scenarios that you have. As for giving two connections in the same diagram a different look, yes this is also possible. You will want to use some kind of StyleSelector or/and DataTemplateSelector and give this to the FlowDiagramFormatter.ConnectionStyleSelector and ConnectionTemplateSelector properties. This is similar to styling nodes differently. This should get you started, but let me know if you need more information. |
|
|
Also make sure that you download the latest nightly build if you are going to follow the blog post I mentioned. The latest nightly build includes a new project called ConnectionValidationSample which demonstrates how to provide your own connection validation logic. |
|
|
Hi,
Thanks for the reply. If I understand it well I have to make my own connection template selector, just like in CustomStyle example. I can use MatchingTemplateSelector and select correct template basing on DataType, so I have to create my own connection class, which will inherits from FlowDiagramConnection and pass the new type to DataType property of MatchingTemplateSelector tag. The question arise how can I choose which connection class will be used when I try to connect two nodes on the interface using mouse.
Regards, Peter |
|
|
This is done by implementing your own IDiagramConnectionBuilder. This has 2 methods for you to implement: CreateConnection. CanCreateConnection. Once you have your own connection builder implementation, you can then give it to the diagram by using IDiagramModel.DefaultConnectionBuilder = ... Let me know if there is something I need to explain better here. Regards |
|
|
Thanks of the explanation. Now all is clear.
Regards, Peter |
|