In my solution the position properties I set in the CustomLink
constructor are simply initial values - basically values by default. As soon as you drag or connect a connection, both values are getting updated.
However, you need to have in mind that when you create a connection in an MVVM diagramming solution, the visual element - RadDiagramConnection
, is created only after the GraphSource AddLink()
method successfully adds the business link in the GrapghSource
collection. This is the main purpose of the AddLink method - to allow you to prepare the business representation of the connection and manually add it in the GraphSource collection. Then, once it's added, the RadDiagram
creates the RadDiagramConnection
and sets its SourceConnectorPosition/SourceConnectorResult
properties accordingly. This is why the source connector properties (like the SourceConnectorPoisiton
) aren't yet generated in the AddLink/CreateLink()
methods of the ObservableGraphSourceBase
implementation and you can't access their real values.
Also, unless you connect the end of the connection to another shape, the RadDiagramConnection
won't know that it has a TargetConnector
and the TargetConnector
-related properties will be also unset.
And the "connector with the name '' (empty string) cannot be found" exception is thrown when you try to bind the SourceConnectorPosition
to business values which are an empty string - once the RadDiagramConnection
starts initializing, the binding tries to set the connectors positions but can't find any connectors with that name. But if you define default values for the business properties, the control will update them accordingly as soon as all related visual elements are properly generated. This is why I suggested that you use the PropertyChanged
callback or the setter of the ConnectorPosition
-related business properties to track their value.
As for your last post, unfortunately I'm not sure I understand your requirements correctly. Specifically I don't know what you mean by "keep my data (viewmodel) synchronized with the GraphSource" and "I would use TwoWay-binding for the GraphSource and use a converter". Can you please elaborate a bit more on that and send us a sample solution demonstrating your scenario? This way we'll be able to better understand the context of your issues and advice you how to implement your requirements.
the Telerik team