public void changeMemberPosition() { var position = new Telerik.Windows.Diagrams.Core.Point(this.Position.X + 10, this.Position.Y + 50); int memberCount = 0; foreach (var item in this.Items) { var member = item as RadDiagramShape; if (member == null) { continue; } member.Position = position; position.X += member.Width + 20; if (++memberCount % 2 == 0) { position = new Telerik.Windows.Diagrams.Core.Point(this.Position.X + 10, position.Y + member.Height + 10); } } if (position.Y + 50 > this.Position.Y + this.Height) { this.UpdateContentBounds(); this.UpdateContainerLayout(); this.MinHeight = this.Height + BottomOffset; this.UpdateContentBounds(); this.UpdateContainerLayout(); } }
private OrgContainerShape CreateNode(XElement element, OrgContainerShape parentNode) { OrgContainerShape orgTeam = new OrgContainerShape() { Name = Nom = element.Attribute("Depto").Value, }; orgTeam.ToggleCollapseButton.ImagePrimitive.Visibility = Telerik.WinControls.ElementVisibility.Hidden; orgTeam.Text = orgTeam.Name; orgTeam.Tag = Nombre = element.Attribute("Name").Value; orgTeam.Path = parentNode == null ? orgTeam.Name : string.Format("{0}|{1}", parentNode.Path, orgTeam.Name); currentLayoutSettings.Roots.Add(orgTeam); if (parentNode != null) { RadDiagramConnection connection = new RadDiagramConnection(); connection.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline; connection.Source = parentNode; connection.Target = orgTeam; this.radDiagram1.AddConnection(connection); } var teamMembers = this.GetTeamMembers(element, orgTeam); var position = new Telerik.Windows.Diagrams.Core.Point(10, 50); int memberCount = 0; foreach (var member in teamMembers) { this.radDiagram1.AddShape(member); orgTeam.Items.Add(member); member.Position = position; position.X += member.Width + 20; if (++memberCount % 2 == 0) { position = new Telerik.Windows.Diagrams.Core.Point(10, position.Y + member.Height + 10); } } orgTeam.IsCollapsedChanged += this.orgTeam_IsCollapsedChanged; return(orgTeam); }
private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { this.TeamMembers = string.Format("{0} Team Members", this.Items.Count); this.MinHeight = 0; if (e.NewItems != null && e.NewItems[0] is RadDiagramShape) { ((RadDiagramShape)e.NewItems[0]).BackColor = this.BaseColor; } var position = new Telerik.Windows.Diagrams.Core.Point(this.Position.X + 10, this.Position.Y + 50); int memberCount = 0; foreach (var item in this.Items) { var member = item as RadDiagramShape; if (member == null) { continue; } member.Position = position; position.X += member.Width + 20; if (++memberCount % 2 == 0) { position = new Telerik.Windows.Diagrams.Core.Point(this.Position.X + 10, position.Y + member.Height + 10); } } if (position.Y + 50 > this.Position.Y + this.Height) { this.UpdateContentBounds(); this.UpdateContainerLayout(); this.MinHeight = this.Height + BottomOffset; this.UpdateContentBounds(); this.UpdateContainerLayout(); } }