Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visualize object properties in a WPF control

Is it possible to visualize an object (its properties along with their values) and print it out (dump it - similar to serialization) to a WPF control, such as TreeView or PropertyGrid to inspect the object?

The goal is to display the contents of any arbitary object (not only for debugging purposes).

For further clarification: I'm not looking for any debugging tools or ways to show the WPF Visual Tree. This question has only partially something to do with WPF -> WPF is only the media to display the object dump because controls may vary between WPF and WinForms.

The output should be hierarchical for nested object instances, lists etc.

Object Visualization

like image 540
Atrotygma Avatar asked Jul 30 '13 20:07

Atrotygma


3 Answers

I think you should take a look at Snoop

  • http://snoopwpf.codeplex.com/

This program will allow you to navigate the WPF tree of any running application. Debugging is not required for this tool and it's possible the tool doesn't work with debugging. Typically I use it in non-debugging scenarios to see how my WPF controls are actually laid out and what values they have for various properties

like image 141
JaredPar Avatar answered Oct 18 '22 20:10

JaredPar


I believe what you are looking for is the System.Diagnostics.DebuggerDisplayAttribute

like image 27
Jay Avatar answered Oct 18 '22 20:10

Jay


You mean besides the WPF Tree Visualizer? there is Mole, which is not free anymore, but very good.

Edit:

Reading your edited question. You are explicitly naming the PropertyGrid, I take it you've already tried Extended WPF Toolkit's PropertyGrid?

like image 34
So Many Goblins Avatar answered Oct 18 '22 19:10

So Many Goblins