Hello,
I have a view model structure inheriting from ObservableGraphSourceBase<T, LinkViewMOdelBase<T>> and the loading and displaying of the shapes and connectors (with respect to the items and links) works very well. UseGlidingConnector = true for the shapes. But when I try and load a new view model structure to replace the existing one, an exception is being thrown with the text:
The gliding connector cannot be removed because connections are attached to it.
I have tried the following: calling Clear() on the view model structure, then setting it to null, then assigning it to a new view model. I've also tried iterating through the connections and clearing the connections before assigning a new viewmodel like so, but the exception still occurred:
Can I load a new view-model hierarchy into a diagram? If so can you advise on what approach to take?
Much thanks,
Mike
I have a view model structure inheriting from ObservableGraphSourceBase<T, LinkViewMOdelBase<T>> and the loading and displaying of the shapes and connectors (with respect to the items and links) works very well. UseGlidingConnector = true for the shapes. But when I try and load a new view model structure to replace the existing one, an exception is being thrown with the text:
The gliding connector cannot be removed because connections are attached to it.
I have tried the following: calling Clear() on the view model structure, then setting it to null, then assigning it to a new view model. I've also tried iterating through the connections and clearing the connections before assigning a new viewmodel like so, but the exception still occurred:
public
void
ClearConnections()
{
foreach
(var link
in
diagram.Connections)
{
diagram.RemoveConnection(link,
false
);
}
RadDiagramShape dShape =
null
;
foreach
(var shape
in
diagram.Shapes)
{
dShape = shape
as
RadDiagramShape;
dShape.Connectors.Clear();
dShape.UseDefaultConnectors =
true
;
}
}
Can I load a new view-model hierarchy into a diagram? If so can you advise on what approach to take?
Much thanks,
Mike