Exemplo n.º 1
0
        private void btnGetTemplateControlList_Click(object sender, RoutedEventArgs e)
        {
            List <Visual>    visualList = WPFHelper.GetTemplateControlList(slider);
            StringBuilder    sb         = new StringBuilder();
            FrameworkElement fe;
            int count = 0;

            foreach (var visual in visualList)
            {
                fe = visual as FrameworkElement;
                if (fe != null)
                {
                    sb.AppendLine($"Name:{fe.Name}      Type:{visual.GetType().FullName}");
                }
                else
                {
                    count++;
                }
            }

            if (count > 0)
            {
                sb.AppendLine($"no FrameworkElement :{count}");
            }

            string str = sb.ToString();
        }