123456789text
//File:Window.xaml.cs
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
public partial class AboutDialog : Window
{
public AboutDialog()
{
InitializeComponent();
}
protected override void OnContentRendered(EventArgs e)
{
base.OnContentRendered(e);
PrintVisualTree(this);
}
void PrintVisualTree(DependencyObject obj)
{
Debug.WriteLine(obj);
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
PrintVisualTree(VisualTreeHelper.GetChild(obj,i));
}
}
}