private void PopulateTreeItems(ItemCollection items, TableDrivedEntityDTO entity, string relationshipPath, string entityPath) { foreach (var column in entity.Columns) { var treeItem = new TreeColumnItem(); treeItem.ColumnID = column.ID; treeItem.ColumnName = column.Name; treeItem.Alias = column.Alias; treeItem.RelationshipPath = relationshipPath; treeItem.EntityPath = entityPath; AddColumnNode(items, treeItem, column.Alias); } foreach (var relationship in entity.Relationships) { var newrelationshipPath = (relationshipPath == "" ? "" : relationshipPath + ",") + relationship.ID; var newEntityPath = (entityPath == "" ? "" : entityPath + ",") + relationship.Entity2; TreeRelationshipItem relItem = new TreeRelationshipItem(); relItem.Relationship = relationship; relItem.RelationshipPath = newrelationshipPath; relItem.EntityPath = newEntityPath; var node = AddRelationshipNode(items, relItem); node.Expanded += Node_Expanded; node.Items.Add("Loading..."); } }
private RadTreeViewItem AddColumnNode(ItemCollection collection, TreeColumnItem treeColumnItem, string title) { var node = new RadTreeViewItem(); node.DataContext = treeColumnItem; node.Header = GetNodeHeader(title, DatabaseObjectCategory.Column); collection.Add(node); return(node); }