#994 – Viewing the Visual Tree from within Visual Studio

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.



About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #994 – Viewing the Visual Tree from within Visual Studio

  1. Pingback: Dew Drop – January 24, 2014 (#1709) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: