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 need to run through all diagram elements and I'm using the code below, however it seems like it only takes the currently visible elements, is this intended behavior? or should I do it in a different way?
Regards, Michael |
|
|
Hello Michael Yes, this is intentional. The DiagramSurface uses virtualization which means that it only creates the visible elements for the nodes and connections within the viewport. This greatly improves the performance. What you'll need to do is iterate through all the model objects instead. This can be done via the Nodes and Connections properties on the Diagram model object. If the action that you need to perform is related to manipulating the visual elements that can't be done with the model objects, then the best practice would be to add properties or functions to your custom node/connection model classes. Then when you iterate the model objects, you can use these properties/functions, and then in the node/connection templates you can use data binding or triggers to manipulate the visuals based on the model object changes. If you have trouble doing this, please describe what you need to do and I'll try come up with some suggestions. -Jason Fauchelle |
|
|
Hi' Jason Okay...... thanks for the explanation. What I'm trying to accomplish is to hide/collapse certain nodes and connections under specific conditions. I can do that by hooking a Visibility property on the node as suggested, but I can still select the collapsed node so I have to set IsSelected to false when selecting, or is there another way to completely hide/collapse the node and disable selection, cursor and tooltip? Regards, Michael |
|
|
Hello Michael In the past, I've done this by using a trigger on the node style (not the NodeTemplate like I mentioned previously). Here is an example for the node styles:
(Where IsVisible is the name of the property on your model that controls the visibility). This will hide the visuals and disable the selection, cursor and tooltips etc all in one go. Let me know if you have further questions about this. -Jason Fauchelle |
|
|
Exactly what I needed..... Thanks :-) Regards, Michael |
|