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); } }
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); } }
/// <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 <Person> parents = DiagramLogic.GetParents(row); if (parents.Count == 0) { return(null); } // Add another row. DiagramRow parentRow = logic.CreateParentRow(parents, nodeScale, nodeScale * Const.RelatedMultiplier, hideAuntsUncles); parentRow.Margin = new Thickness(0, 0, 0, Const.RowSpace); parentRow.GroupSpace = Const.ParentRowGroupSpace; InsertRow(parentRow); return(parentRow); }
/// <summary> /// Add a child row to the diagram. /// </summary> private DiagramRow AddChildRow(DiagramRow row) { // Get list of children for the current row. List <Person> 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, hideInLaws); childRow.GroupSpace = Const.ChildRowGroupSpace; AddRow(childRow); return(childRow); }