public void DisplayNode(INode node, int depth) { depth--; Button btn = new Button { Width = 80, Height = 80, Margin = new Thickness(50 + (200 * depth), 50 + (200 * depthCounter[depth]) + (depth % 2 == 0 ? 0 : 100), 5, 5), Content = (node is IMultipleInputs ? node.Name + "\n(" + ((IMultipleInputs)node).Type + ")" : node.Name), Name = node.Name, Tag = (depthCounter[depth], depth), Background = controller.GetColor(node), Style = this.FindResource("HoverButton") as Style }; btn.MouseEnter += new MouseEventHandler(Button_MouseEnter); btn.MouseLeave += new MouseEventHandler(Button_MouseLeave); btn.Click += Button_Click; Canvas.Children.Add(btn); Canvas.SetZIndex(btn, 3); TextBlock txt = new TextBlock { Name = "nano", Width = 80, Height = 20, Margin = new Thickness(50 + (200 * depth), 130 + (200 * depthCounter[depth]) + (depth % 2 == 0 ? 0 : 100), 5, 5), Text = (node.RealDepth * 15) + " nanosec.", TextAlignment = TextAlignment.Right }; Canvas.Children.Add(txt); Canvas.SetZIndex(txt, 5); if (Canvas.Height < 200 + (200 * depthCounter[depth]) + (depth % 2 == 0 ? 0 : 100)) { Canvas.Height = 200 + (200 * depthCounter[depth]) + (depth % 2 == 0 ? 0 : 100); } if (Canvas.Width < 200 + (200 * depth)) { Canvas.Width = 200 + (200 * depth); } depthCounter[depth]++; }