예제 #1
0
        public static string GetName(Panel container, DependencyObject item)
        {
            int count = 0;
            string basename = item.GetType().Name;
            string name = basename;

            while(container.FindName(name) != null)
                name = string.Format("{0}{1}", basename, ++count);

            return name;
        }
 private Point GetPosition(string name, Panel panel)
 {
     return ((UIElement)panel.FindName(name))
         .TransformToAncestor(panel)
         .Transform(new Point(0, 0));
 }
        private void AddTimeoutVerticalLine(Panel timeout, StackPanel panel, Grid parent, ref Point lastPoint, ref Point timeoutPoint, int i)
        {
            var timeoutIcon = timeout.FindName("TimeoutIcon") as FrameworkElement;
            var timeoutIconPosition = timeoutIcon.TransformToAncestor(panel).Transform(new Point(0, 0));
            timeoutPoint = new Point(timeoutIconPosition.X + timeoutIcon.ActualWidth / 2, timeoutIconPosition.Y);

            AddLine(lastPoint, timeoutPoint, parent);
            timeoutPoint.Y += timeoutIcon.ActualHeight;
            lastPoint = timeoutPoint;
        }