摘要: private void PrintVisialTree(int depth, DependencyObject obj) { System.Diagnostics.Debug.WriteLine(new string(' ', depth) + obj); for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { PrintVisialTree(depth + 1, VisualTreeHelper.GetChild(obj, i)); } } protected overr... 阅读全文
posted @ 2011-11-25 10:11 quietwalk 阅读(154) 评论(0) 推荐(0)
摘要: private void PrintLogicalTree(int depth, object obj) { System.Diagnostics.Debug.WriteLine(new string(' ', depth) + obj); if (!(obj is DependencyObject)) { return; } foreach (object child in LogicalTreeHelper.GetChildren(obj as DependencyObject)) { PrintLogicalTree(depth + 1, chil... 阅读全文
posted @ 2011-11-25 10:06 quietwalk 阅读(179) 评论(0) 推荐(0)
摘要: Window window = null; using (FileStream fs = new FileStream("MyWindow.xaml", FileMode.Open, FileAccess.Read)) { window = (Window)System.Windows.Markup.XamlReader.Load(fs); } System.Windows.Controls.Button btnOk = (System.Windows.Controls.Button)window.FindName("btnOk"); 阅读全文
posted @ 2011-11-25 09:08 quietwalk 阅读(317) 评论(0) 推荐(0)