Smart mindmap like autolayout

2 posts, 0 answers
  1. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 14 Oct 2013 Link to this post

    Hi,

    I am looking at implementing a automatic mindmap diagram layout in order to enforce the position of the items dropped as well as update the layout whenever a branch is expanded or collapsed. The basic behavior I am looking for is similar to the one provided as a sample with the mindmap layout sample. One of the tricky part is to update the existing item's position when the user expands a node in order to avoid items overlap. Do you recommand a particular approach in this area. XMind does a pretty good job in this area and this is the kind of behavior I am trying to implement.



    Rgds

    Robert

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 17 Oct 2013 Link to this post

    Hello Robert,

     Usually in order to avoid overlapping, invoking the Layout method should be enough. On Expand/Collapse, if it is performed in the ViewModel, you can throw an event , for instance ExpandCollapsePerformed, the view can listen to a ViewModel's events and simply invoke the Layout function in  the event handlers. Actually similar approach is implemented in our OrgChart demo.

    this.viewModel.ChildrenIsExpandedChanged += this.OnViewModelChildrenExpandedOrCollapsed;
    private void OnViewModelChildrenExpandedOrCollapsed(object sender, TeamExpandCollapseChangeEventArgs e)
            {
                if (this.viewModel.ShouldLayoutAfterExpandCollapse)
                {
                    this.UpdateViewPortWhenTeamVisualChange(e.Team, true);
                }
                this.navigationPane.RefreshThumbnail();
            }
    private void UpdateViewPortWhenTeamVisualChange(OrgTeamViewModel team, bool isLayoutSynchronous)
          {
              Point oldPosition = team.Position;
              this.LayoutOrgChart(false, isLayoutSynchronous);
              this.diagram.UpdateViewportRespectingShape(oldPosition, team.Position);
          }

    Regards,
    Petar Mladenov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top