Empty visual tree in WPF

176 Views Asked by At

I just want to see visual elements of controls, and to do it I created a really basic window which contains two labels and button. The problem is that I can't see any visual as I expected either in VisualTreeHelper or visual studio's tool named "WPF Tree Visualizer".

Current project

The weird part is that it works in my another project.

Another project

What may cause of this? Why it doesn't work as in my other project?

1

There are 1 best solutions below

2
Jesse Good On

Looks like you are calling the code in the constructor. Try calling the same code in the window loaded event and you should see a difference.