#994 – Viewing the Visual Tree from within Visual Studio
January 24, 2014 1 Comment
A visual tree in WPF is the complete hierarchy of all visual elements that make up your user interface. The visual tree will contain lower-level elements that are not necessarily part of the higher-level logical tree, as defined in your XAML.
You can view the visual tree for UI elements in an WPF application from within Visual Studio, as follows.
Add a breakpoint in the code for your main window that occurs after the application has loaded. In the example below, we break after pressing a Button.
In the Locals window, find the object representing your main window. In the Value column, hover over the magnifying glass and notice that it’s labeled WPF Tree Visualizer.
Click on the magnifying glass to open the WPF Tree Visualizer. The WPF Tree Visualizer will open in a new window. You can view the Visual Tree in the upper left corner of the window.
Pingback: Dew Drop – January 24, 2014 (#1709) | Morning Dew