internal DiagramItem(Diagram diagram)
        {
            _diagram = diagram;
            _label = null;
            _drawer = null;
            _geometry = null;
            _border = null;

            NeedRecalc = true;

            IsSelectable = true;
        }
        public DiagramNode(Diagram diagram)
            : base(diagram)
        {
            _label = new DiagramLabel(diagram, this);
            _label.NeedRecalc = true;

            _edges = new DiagramItemCollection<DiagramEdge>(diagram);

            IsUnderCursor = false;

            if (!diagram.Nodes.Contains(this))
                diagram.Nodes.Add(this);
        }
        public DiagramEdge(Diagram diagram)
            : base(diagram)
        {
            _sourceNode = null;
            _destinationNode = null;

            Background = new SolidColorBrush((BorderPen.Brush as SolidColorBrush).Color);

            _label = new DiagramLabel(diagram, this);
            _label.NeedRecalc = true;

            if (!diagram.Edges.Contains(this))
                diagram.Edges.Add(this);
        }
        private void SaveLabelToXElement(XElement xItem, DiagramLabel label)
        {
            XElement xLabel = new XElement("Label");

            WriteElement(xLabel, "RelativePosition", label.RelativePosition);
            WriteElement(xLabel, "Text", label.Text);
            SaveItemPart(xLabel, label);

            xItem.Add(xLabel);
        }
        private void LoadLabelFromXElement(XElement xLabel, DiagramLabel label)
        {
            Point relPos = new Point();
            if (ReadElement(xLabel, "RelativePosition", out relPos))
            {
                label.RelativePosition = relPos;
            }

            string text = "";
            if (ReadElement(xLabel, "Text", out text))
            {
                label.Text = text;
            }

            LoadItemPart(xLabel, label);
        }
 public LabelEventArgs(Diagram diagram, DiagramLabel label)
     : base(diagram)
 {
     Label = label;
 }