Esempio n. 1
0
        private void AddNodes(IEnumerable <INode> nodes)
        {
            if (nodes == null)
            {
                return;
            }

            foreach (INode node in nodes)
            {
                if (node != null)
                {
                    _algorithm.AddNode(node);
                    var item = new NetworkViewNodeItem
                    {
                        Content = node
                    };
                    var binding = new Binding("NodeTemplate")
                    {
                        Source = this
                    };
                    BindingOperations.SetBinding(item, ContentPresenter.ContentTemplateProperty, binding);
                    SetZIndex(item, NodeZIndex);

                    _nodesToItems.Add(node, item);
                    Children.Add(item);
                }
            }
        }