コード例 #1
0
        private void AddArrowHeadToDiagramSpace(VisualisedTypeViewMetadata associate, UserControl head)
        {
            // Arrow head is added to diagram before the connector line.
            //this.DiagramSpace.Children.Add(head);
            //head.DataContext = null;
            //var relocateHeadArrow = new Action(() =>
            //                                       {
            //                                           if (this.pauseRearrangeEvents)
            //                                           {
            //                                               return;
            //                                           }
            //                                           ConnectionRoute route = ConnectionRoute.FindBestConnectionRoute(this.subjectMetadata.Area, associate.Area, IsOverlappingWithOtherControls);
            //                                           associate.LineRoute = route;
            //                                           route.CalculateArrowHeadRotationAndTranslation(ConnectionRoute.LineEnd.ArrowHead, head.ActualWidth, head.ActualHeight, associate.DataContext);
            //                                           // move the arrow head to position into gap between line end and the target.
            //                                           head.DataContext = route;
            //                                           Canvas.SetLeft(head, route.To.X);
            //                                           Canvas.SetTop(head, route.To.Y);
            //                                           // this.LineTailDiagnostics(head, route, associate);
            //                                       });

            //head.Loaded += (s, e) => relocateHeadArrow();
            //associate.Moved += (s, e) => Dispatcher.BeginInvoke(relocateHeadArrow);
            //this.subjectMetadata.Moved += (s, e) => Dispatcher.BeginInvoke(relocateHeadArrow);
        }
コード例 #2
0
 private void OnAssociateControlLoaded(VisualisedTypeViewMetadata control)
 {
     PositionTheAssociateControl(control.Container, control.DataContext);
     control.Area.Update(control.Container);
     DrawLine(control);
 }
コード例 #3
0
        private void DrawLine(VisualisedTypeViewMetadata associate)
        {
            //UserControl head = associate.DataContext.CreateLineHead();
            //AddArrowHeadToDiagramSpace(associate, head);
            //// UserControl tail = this.AddLineTail(head, associate);

            //var line = new Line { SnapsToDevicePixels = true, DataContext = associate.DataContext, };
            //associate.DataContext.StyleLine(line);
            //this.DiagramSpace.Children.Add(line);

            //var visibilityBinding = new Binding { Path = new PropertyPath("Show"), Converter = new BooleanToVisibilityConverter() };
            //BindingOperations.SetBinding(line, VisibilityProperty, visibilityBinding);

            //var relocateLine = new Action(() =>
            //                                  {
            //                                      if (this.pauseRearrangeEvents)
            //                                      {
            //                                          return;
            //                                      }

            //                                      ConnectionRoute route = associate.LineRoute; // Set by adding the arrow head.
            //                                      Point position = route.To.Clone();
            //                                      Canvas.SetLeft(line, position.X);
            //                                      Canvas.SetTop(line, position.Y);
            //                                      // var endPoint = new Point(Canvas.GetLeft(tail), Canvas.GetTop(tail));
            //                                      Point endPoint = route.From.Clone();
            //                                      line.X2 = position.X > endPoint.X ? -(position.X - endPoint.X) : endPoint.X - position.X;
            //                                      line.Y2 = position.Y > endPoint.Y ? -(position.Y - endPoint.Y) : endPoint.Y - position.Y;
            //                                  });
            //line.Loaded += (s, e) => relocateLine();
            //line.MouseLeftButtonDown += OnLineClicked;
            //line.MouseEnter += OnMouseOverLine;
            //line.MouseLeave += OnMouseLeaveLine;
            //associate.Moved += (s, e) => Dispatcher.BeginInvoke(relocateLine);
            //this.subjectMetadata.Moved += (s, e) => Dispatcher.BeginInvoke(relocateLine);
        }