public void ButtonAddSubNode_Click(object sender, RoutedEventArgs e)
 {
     var selectedNode = SelectedValue as Node;
     if (selectedNode != null)
     {
         var node = new Node();
         node.Name = "新しいノード" + Document.Instance.Number.ToString();
         node.Parent = selectedNode;
         selectedNode.SubNodes.Add(node);
         selectedNode.IsShowSubnodes = true;
         node.IsSelectedOnTree = true;
         _addLocal = true;
         Document.Instance.Add(node);
     }
 }
        private void addFigureRectangle(Point point)
        {
            var node = new Node();
            node.Left = Math.Min(point.X, _lastPoint.X);
            node.Top = Math.Min(point.Y, _lastPoint.Y);
            node.Width = Math.Abs(point.X - _lastPoint.X);
            node.Height = Math.Abs(point.Y - _lastPoint.Y);
            node.Name = "新しいノード" + Document.Instance.Number.ToString();

            if (ToolButtonState.Instance.FigureButtonState == FigureButtonStates.Rectangle)
            {
                node.FigureType = FigureTypes.Rectangle;
            }
            else if (ToolButtonState.Instance.FigureButtonState == FigureButtonStates.RoundedRect)
            {
                node.FigureType = FigureTypes.RoundedRect;
            }
            else if (ToolButtonState.Instance.FigureButtonState == FigureButtonStates.Ellipse)
            {
                node.FigureType = FigureTypes.Ellipse;
            }

            Document.Instance.Add(node);
            node.IsSelected = true;

            ToolButtonState.Instance.FigureButtonState = FigureButtonStates.Select;
        }
 private void bindNodeFigure(Node node)
 {
     var figure = new FigureRectangle();
     figure.DataContext = node;
     BindingFunctions.BindProperty(figure, node, "FigureType",
         FigureRectangle.FigureTypeProperty, BindingMode.TwoWay);
     BindingFunctions.BindProperty(figure, node, "IsSelected",
         FigureBase.TrackerVisibleProperty, BindingMode.TwoWay);
     this.Children.Add(figure);
 }