WPF Inspector

Introduction

WPF Inspector is a utility that attaches to a running WPF application to troubleshoot common problems with layouting, databinding or styling. WPF Inspector allows you to explore a live view of the logical- and visual tree, read and edit property values of elements, watch the data context, debug triggers, trace styles and much more.

Attaching to a running application

When WPF Inspector is launched, you see a list of running WPF applications. Doubleclick one or select and press "Attach" to start the inspection.

Attaching to a running application

Inspecting the visual and logical tree

After attaching to the application, the inspector window is opened. It shows the elements of either the visual or logical tree. By selecting one, you can see and edit all properties of the elements.

Hovering over the application while pressing the CTRL key automatically selects the element that is below the cursor. By pressing CTRL+SHIFT you can also select parts of the control template.

Major parts of the view are marked bold. The number next to the element shows the number of descendants. When hovering over an element in the tree, a tooltip shows the visual representation of the element.

Inspecting logical and visual tree

View and edit Properties

WPF Inspector provides a mature property grid that includes editors for all common data types including a search. The square behind the property shows the source of the value. If the value is databound, a yellow border is shown and you can see the binding expression. Modified values are highlighted by a blue background for a few seconds. You can also set breakpoints to any property that breaks into the debugger, when the value changes.

The property grid

See the DataContext

Another useful functionality is to see the content of the DataContext. This is very helpful to search for problems in bindings. The property grid updates live and allows expansion of complex types.

The property grid

Debugging Triggers

Triggers are very powerful, but they can also be very tricky to debug, since they are part of WPF, so there is no chance to set a breakpoint and see the values. WPF Inspector provides the very unique functionality to live see the values and conditions of triggers.

The property grid

Last edited Mar 10, 2011 at 11:52 PM by cmoser, version 11