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'm certain this is a very easy functionality to implement, but I'm having little luck at it. We want the connection point on a diagram node to change appearance when the IsRequestingConnectionPoint state is active. My approach (which isn't working) is as such. In the ControlTemplate for the DiagramConnectionElement, there is a setter like such:
Where ConnectionPointRequestingConnectionTemplate is a simple ControlTemplate with nothing but a colored rectangle. Is the template and/or style of the connection point being overridden somehow? |
|
|
Hello I used your code in the CustomStyle.FlowDiagrams sample project, and the connection point successfully got the colored rectangle template at my end. Note: rather than using a trigger, you may want to just set the Template property directly since the RequestedConnectionPoint is not visible unless IsRequestingConnectionPoint is true. If you have not figured out this issue yet, please send me a repro project by attaching it a forum post. Then I'll get back to you with the solution. Jason Fauchelle |
|
|
I've attached a sample project that demonstrates the approach I was attempting, which doesn't work as desired. In this project, there is a CustomNode class and style which makes a number of the visual changes we desire. Most Notably the connection points are always visible and colored based on the sort of data they contain, and the resizer/rotator visual elements are removed. The default style for the ConnectionPointThumb (ConnectionPointThumbTemplate) is a simple ContentPresenter with a FixedTemplateSelector selecting the custom ConnectionPointTemplate created to make the connection points rectangular and properly colored. There is another template, (ConnectionPointThumbRequestingConnectionTemplate) which is essentially identical, but has a pink border around the ConnectionPointTemplate to indicate that the point is the requested target of the connection. In the ConnectionStyle for the DiagramConnectionElement, there is a trigger to set the Template of the RequestedConnectionPoint to the ConnectionPointThumbRequestingConnectionTemplate, which should make the requested target of the connection gain a pink border, but doesn't. Is there an easier or more straightforward way to accomplish this? We really just want to highlight the ConnectionPoint when it is the intended target of a new connection. |
|
|
Hello Thanks for the repro project. The IsRequestingConnectionPoint property is actually used for connection-mounted scenarios. For your scenario, I've added a new property on ConnectionPointThumb called IsConnectionDragOver. This will be available in the next nightly build. I've also reattached your repro project showing how best to use this property. To run the demo, you'll need to get the next nightly build, and also re-add the Mindscape.WpfDiagramming.Foundation.dll and .FlowDiagrams.dll references. I removed the requesting-connection templates and styles as you won't need these. The main part you'll be interested in is the ConnectionPointTemplate on lines 179 to 188 of App.xaml as seen below:
This is the best place to put the trigger that checks the new IsConnectionDragOver property and displays the highlighting border. I also set the OverridesDefaultStyle property of the ConnectionPointThumbStyle at line 20 which fully overrides the default visibility triggers. Let me know if you have further questions about this. Jason Fauchelle |
|
|
Great, the IsConnectionDragOver property gives us the exact functionality we need. Thanks! |
|