private void Body_LayoutUpdated(object sender, EventArgs e) { Point vl2 = AnchorL.TransformToVisual(Layout).Transform(new Point()); Point vr2 = AnchorR.TransformToVisual(Layout).Transform(new Point()); VerticalL.X1 = VerticalL.X2 = 0; VerticalL.Y2 = vl2.Y; VerticalR.X1 = VerticalR.X2 = Body.ActualWidth; VerticalR.Y2 = vr2.Y; HorizentalL.X1 = 0; HorizentalR.X2 = VerticalR.X1; }
private void Container_LayoutUpdated(object sender, EventArgs e) { for (int i = 0; i < Placer.Children.Count; i++) { UIElement ue = Placer.Children[i]; if (ue is IElement) { IElement element = ue as IElement; Point lp = element.LeftAnchor.TransformToVisual(Layout).Transform(new Point()); Point rp = element.RightAnchor.TransformToVisual(Layout).Transform(new Point()); LinkLine lline = Lines.Children[i] as LinkLine; LinkLine rline = Lines.Children[i + 1] as LinkLine; lline.SetEnd(lp.X + (element.LeftAnchor as Rectangle).Width, lp.Y); rline.SetStart(rp.X, rp.Y); } } Point la = AnchorL.TransformToVisual(Layout).Transform(new Point()); Point ra = AnchorR.TransformToVisual(Layout).Transform(new Point()); LinkLine left = Lines.Children[0] as LinkLine; LinkLine right = Lines.Children[Lines.Children.Count - 1] as LinkLine; left.SetStart(la.X, la.Y); right.SetEnd(ra.X, ra.Y); }