TreeLayout and IgnoreContainers

2 posts, 0 answers
  1. Max
    Max avatar
    6 posts
    Member since:
    Feb 2015

    Posted 06 Apr 2015 Link to this post

    Hello. I tried to apply tree layout on 50 generated nodes (by first tab).

    This is result:

    http://joxi.ru/L21RM8Quq4zWAX

    But, while IgnoreContainers=true, result is:

    http://joxi.ru/Vm6dpMLSqZvyAZ

    Why  layouting don't work in this case? I don't want to involve containers in layouting algotithm.

    The screenshots are from your demo projects (xaml-sdk-master).

     

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 07 Apr 2015 Link to this post

    Hello Max,

    Thank you for bringing this issue to our attention. Indeed, it's a bug in our RadDiagram and we logged it in our feedback portal where you can track its progress. We updated your telerik account points as thanks for your cooperation. 

    As a temporary workaround, you can save the containers positions in a dictionary and re-set them after Layout:
    Dictionary<RadDiagramContainerShape, Point> ContainerPositions = new Dictionary<RadDiagramContainerShape, Point>();
    private void RadButton_Click(object sender, RoutedEventArgs e)
          {
              TreeLayoutSettings sett = new TreeLayoutSettings()
              {
                  TreeLayoutType = TreeLayoutType.TreeDown,
                  IgnoreContainers = false,
              };
              sett.Roots.Add(this.diagram.Shapes[0]);
     
     
             this.diagram.Shapes.OfType<RadDiagramContainerShape>().ForEach(x => ContainerPositions.Add(x, x.Position));
             this.diagram.DiagramLayoutComplete += (oo, ee) =>
              {
                  this.diagram.Shapes.OfType<RadDiagramContainerShape>().ForEach(x => x.Position = ContainerPositions[x]);
              };
             this.diagram.Layout(LayoutType.Tree, sett);
            
          }


    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top