Пример #1
0
        public void InitMockup()
        {
            var viewNode = new ViewNodeControl()
            {
                Width = 100, Height = 50, Title = "First", AllowDrop = true
            };

            viewNode.HighlightAdorner = new HighlightAdorner(viewNode);
            viewNode.LinkAdorner      = new LinkAdorner(viewNode);
            viewNode.Drop            += LinkAction;

            viewNode.IsSelectedChanged += (node, isSelected) => {
                if (isSelected)
                {
                    NodesList.ToList().ForEach(n => { if (n.Equals(node) == false)
                                                      {
                                                          (n as ISelectable).IsSelected = false;
                                                      }
                                               });
                }
            };

            NodesList = new ObservableCollection <UIElement>();
            NodesList.Add(viewNode);

            viewNode = new ViewNodeControl()
            {
                Width = 100, Height = 50, Title = "Second", AllowDrop = true
            };
            viewNode.HighlightAdorner = new HighlightAdorner(viewNode);
            viewNode.LinkAdorner      = new LinkAdorner(viewNode);
            viewNode.Drop            += LinkAction;

            viewNode.IsSelectedChanged += (node, isSelected) => {
                if (isSelected)
                {
                    NodesList.ToList().ForEach(n => { if (n.Equals(node) == false)
                                                      {
                                                          (n as ISelectable).IsSelected = false;
                                                      }
                                               });
                }
            };
            NodesList.Add(viewNode);
        }