看到别人做出的优秀的WPF作品时,有时想了解该作品的实现,例如,布局元素的应用、样式、资源文件的使用等等。这时,利用WPF Inspector这个工具就可以很方便的查看这个作品的一些信息的,功能真的很强大。
首先看官方的介绍: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. Since March 2011, WPF Inspector is open source and available on CodePlex.
这个工具是开源的,我们可以在CodePlex上下载使用。
最后简单试用下WPF Inspector,首先打开要查看的WPF程序,接着运行WPF Inspector,这里可以看到WI已经获取到正在运行的WPF程序,选择要查看的程序:
接着就可以查看这个程序的Visual-Tree,Logic-Tree,Style,Resources等等。