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 am wondering how can I bind my ViewModel's IsSelected directly working with the DiagramElement's IsSelected property? Right now, I am actually intercepting the SelectedElementsChanged event and manually set the IsSelected flag in each nodes, which I think is not that efficient since selectedElementChanged event doesn't provide me with what items are added / removed etc, that means I'll need to go through every ViewModels, set them false, then set those selected nodes with true accordingly. I wish to speed up a bit on the selection because of custom logic that I've put in during selection.(I did it here: https://www.mindscapehq.com/forums/thread/4787) |
|
|
Unfortunatly there isn't a convenient way to set a binding from the DiagramElement.IsSelected property to a property in the node model. One way would be to set up the binding in code within the node builder. In the CreateNode method of a node builder, after the node has been added to the diagram, use the FindNodeElement method on a DiagramSurface to get the DiagramNodeElement for the newly created node model. Then set up a binding between the IsSelected property on the element to the model. This would mean the node builder would need acess to the DiagramSurface which is generally undesired, but may be the best way to setup a binding. -Jason |
|