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
|
Hello, When the user select some of the nodes and press delete key, I only want to change the appearance of the nodes and make it cannot be selected and moved, so I add a property IsDeleted in my node model, and write my own node remover, in the node remover I only set the IsDeleted property of the nodes to true, and I add some triggers in FullDiagramNodeTemplate:
But it doesn't work, the node can be selected and moved, so what should I do? Thanks |
|
|
Hello, I have fixed this by changing the "Content.IsDeleted" to "Node.IsDeleted", now the mover is collapsed, and the node can not be selected singlely. But it still can be selected with the other node together, and can be moved with the other nodes, how can I make it not selectable, and how can I make a connection not selectable. Thanks |
|
|
Hello Jzhou Good to see you solved the binding issue. I'll have a look next week at the best way to disable selection for individual nodes and connections. Jason Fauchelle |
|
|
Hello Jzhou Here is the best way I've found to handle this selection logic. Attach a handler to the DiagramSurface that listens to the ListBoxItem.SelectedEvent. Here is how this would look:
Then in the handler, you can check e.OriginalSource to get the selected element. If the element is a node element, and the model of this element has IsDeleted set to true, then deselect the element. Similar logic can be used for connections. Here is an example:
SampleNode is just a node implementation that has the IsDeleted property. My connection logic example simply prevents any connection from ever being selected. Jason Fauchelle |
|