This is a migrated thread and some comments may be shown as answers.

Offset of custom connectors doesn't work after graphSource.Clear()

0 Answers 79 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Jackey
Top achievements
Rank 1
Jackey asked on 11 Apr 2015, 08:40 AM

Hi team,

In order to make my problem clear, I would list what I've done currently.

1. I am using MVVM, so I have view models of nodes, links and a graph source. All these implementations follow the guideline of RadDiagram MVVM. And it works fine.

2. Then I want to define some custom connectors. According to this thread, I manage to add custom connectors to my digram.

3. The solution of that thread mentioned above is using a attached property. And I also have a requirement: I need to remove or add nodes runtime. So I have following codes

 

if (this._graphSource == null)
{
    this._graphSource = new LineGraph();
}
 
this._graphSource.Clear();
this._graphSource.PopulateGraph(this);
return this._graphSource;


And when my application starts up for the first time, the offsets of the custom connectors work properly. However, when I add or remove nodes, the above if statement wouldn't be executed, it would clear all the nodes existed, and re-populate the graph again. However, the offsets don't take effect now. Removing the if statement, then the offset works no matter I add or delete nodes.

The key is I don't want to create the LineGraph object each time I delete or add nodes. 

Hope make myself clear.

Best Regards,

Jingfei

No answers yet. Maybe you can help?

Tags
Diagram
Asked by
Jackey
Top achievements
Rank 1
Share this question
or