private void contextMenuLinkToNodeButton_Click(object sender, RoutedEventArgs e) { Canvas mainCanvas = (Canvas)this.Parent; LinkingLine line = new LinkingLine(this); line.X1 = Canvas.GetLeft(this) + (this.Width / 2); line.Y1 = Canvas.GetTop(this) + (this.Height / 2); mainCanvas.Children.Add(line); Canvas.SetZIndex(line, 0); wasContextMenuOptionSelected = true; }
private void WeightedNodeControl_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (isNewNode == true) { WeightedNodeControl nodeControl = sender as WeightedNodeControl; WeightedNodeControl newNode = new WeightedNodeControl(); isNewNode = false; LinkingLine line = new LinkingLine(nodeControl, newNode); line.X1 = Canvas.GetLeft(nodeControl) + (nodeControl.Width / 2); line.Y1 = Canvas.GetTop(nodeControl) + (nodeControl.Height / 2); mainCanvas.Children.Add(line); mainCanvas.Children.Add(newNode); Canvas.SetZIndex(line, 0); Canvas.SetZIndex(nodeControl, 1); Canvas.SetZIndex(newNode, 1); } }
public void RemoveLinkingLine(LinkingLine linkingLine) { linkingLines.Remove(linkingLine); }
public void AddLinkingLine(LinkingLine linkingLine) { linkingLines.Add(linkingLine); }