Example #1
0
        public Diagram()
        {
            // Init the diagram logic, which handles all of the layout logic.
            logic = new DiagramLogic();
            logic.NodeClickHandler = new RoutedEventHandler(OnNodeClick);

            // Can have an empty People collection when in design tools such as Blend.
            if (logic.Family != null)
            {
                logic.Family.ContentChanged += new EventHandler <ContentChangedEventArgs>(OnFamilyContentChanged);
                logic.Family.CurrentChanged += new EventHandler(OnFamilyCurrentChanged);
            }
        }
Example #2
0
        /// <summary>
        /// Add a parent row to the diagram.
        /// </summary>
        private DiagramRow AddParentRow(DiagramRow row, double nodeScale)
        {
            // Get list of parents for the current row.
            Collection <DrawStructure.Main.Shape> parents = DiagramLogic.GetParents(row);

            if (parents.Count == 0)
            {
                return(null);
            }

            // Add another row.
            DiagramRow parentRow = logic.CreateParentRow(parents, nodeScale, nodeScale * Const.RelatedMultiplier);

            parentRow.Margin     = new Thickness(0, 0, 0, Const.RowSpace);
            parentRow.GroupSpace = Const.ParentRowGroupSpace;
            InsertRow(parentRow);
            return(parentRow);
        }
Example #3
0
        /// <summary>
        /// Add a child row to the diagram.
        /// </summary>
        private DiagramRow AddChildRow(DiagramRow row)
        {
            // Get list of children for the current row.
            List <DrawStructure.Main.Shape> children = DiagramLogic.GetChildren(row);

            if (children.Count == 0)
            {
                return(null);
            }

            // Add bottom space to existing row.
            row.Margin = new Thickness(0, 0, 0, Const.RowSpace);

            // Add another row.
            DiagramRow childRow = logic.CreateChildrenRow(children, 1.0, Const.RelatedMultiplier);

            childRow.GroupSpace = Const.ChildRowGroupSpace;
            AddRow(childRow);
            return(childRow);
        }