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

Connections are not drawn

1 Answer 84 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Kannan
Top achievements
Rank 1
Kannan asked on 27 Aug 2012, 10:15 AM
Hi,

I am new to Telerik controls. I have tried to replicate the OrgChart sample and with simple collection. The Nodes and its links are not rendered correctly. I hereby attached the sample application which i have created.

Sample Location: 
https://skydrive.live.com/embed?cid=AC91C223AC3358A4&resid=AC91C223AC3358A4%21122&authkey=ALqVcUXpeMIBm2M

Please correct me if i did anything wrong,

Regards,
Kannan. s

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 27 Aug 2012, 02:59 PM
Hi Kannan,

 The RadDiagram must have prepared it's containers - (RadDiagramShapes and RadDiagramConnections) before invoking Layout and Routing methods. So instead of MainPage.Loaded, you can use the Diagram Loaded (which will fire later) and even add a Dispatcher to ensure the creation of the shapes.

this.GraphSource = new GraphSource();
    this.PopulateWithData();
    this.PopulateGraphSources();
    this.DataContext = this;
    GetViewModelAndBindForEvents();
    this.diagram.RoutingService.Router = this.router;
    this.treeLayout = new TreeLayout();
    this.diagram.Loaded += new RoutedEventHandler(diagram_Loaded);
    //this.diagram.Connections.ForEach(x => RadDiagramConnection.SetIsAutoUpdateSuppressed((RadDiagramConnection)x, true));
    //this.diagram.Connections.ForEach(x => RadDiagramConnection.SetIsAutoUpdateSuppressed((RadDiagramConnection)x, false));
    //this.diagram.Connections.ForEach(x => x.Update());
     
}
 
void diagram_Loaded(object sender, RoutedEventArgs e)
{
    SetLayoutRoots();
    Dispatcher.BeginInvoke(()=>
     this.LayoutOrgChart(false));
}
 
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    //SetLayoutRoots();
   // this.LayoutOrgChart(false);
}
You can find this realized in the attached solution. Please let us know if the suggested approach is suitable for you. Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Kannan
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or