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

Smart mindmap like autolayout

1 Answer 104 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 14 Oct 2013, 03:49 PM

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

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 17 Oct 2013, 08:11 AM
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 >>
Tags
Diagram
Asked by
Robert
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or