Getting the position of a treeview item related to a canvas
Share
TreeViewItem tvi = e.NewValue as TreeViewItem; GeneralTransform myTransform = tvi.TransformToAncestor(StepsTreeView); Point myOffset = myTransform.Transform(new Point(0, 0)); //txt1 is a textbox in xaml. This could be a canvas or any other control // that may contain other controls txt1.Text = myOffset.ToString(); txt1.SetValue(Canvas.TopProperty, myOffset.Y); txt1.SetValue(Canvas.LeftProperty, myOffset.X + 250); AssemblyNameLabel.Content = myOffset.ToString(); easyShapes.easyLine(rootCanvas, myOffset, new Point(0, 0), 3);