Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
XamDiagram resetting position of nodes on view change

I have an app where one view is a xamDiagram and toolbox allowing the user to create a workflow type diagram. I have two node types, each bound to a separate data type deriving from a "node" data type that I have defined. The item source for the XamDiagram is a collection of objects of the "node" data type. I am using two node definitions with their own node style where I can bind to the two derived types based on node type. This works well for everything but node position. Each node has a position property that I am setting as nodes are dropped or moved. Whenever I swap views by changing the ContentControl ContentTemplate in the main view, if I swap back to the view containing the XamDiagram, the nodes are all at position 0,0 on top of one another, despite the position property of each node in the item source collection still being set to the correct position. Is there a way to bind the nodes' position to the property in my classes so that the diagram will still reflect those positions when the view is changed? I can't do something like this: <Setter Property="Position" Value="{Binding Position}" /> in my NodeStyle since the binding will look for a position property in my view model rather than in the class that goes with the target type of the node.

Parents Reply Children