调试 WPF:工具和技术
好的,所以我只是浪费了一个小时寻找为什么我的外观 WPF 控件没有显示在窗口中。
最终,我追踪到我忘记在主题目录下的 generic.xaml 文件中添加 ResourceDictionary 条目。风格和课程本身都还不错。
有没有办法跟踪 WPF 内部发生的情况?如何跟踪样式如何加载(或未加载)。我想这一定会成为一大堆需要查看的东西,但肯定比检查每个文件是否有拼写错误或我忘记的东西更好。
(我搜索过其他问题,但主要是针对特定案例)
谢谢!
Ok, so I just wasted an hour hunting why my lookless WPF control wasn't showing up in the Window.
Eventually, i traced it to the fact that I forgot to add the ResourceDictionary entry in the generic.xaml file under the themes directory. The style and the class itself was OK.
Is there a way to trace what is going on inside WPF? How to trace how a style gets loaded (or NOT loaded). I imagine that must become a huge stack of stuff to look at, but there has got to be better than having to check each and every file for typos or stuff i forgot.
(I've searched for other questions but there's mostly for a specific case)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能对您的特定问题没有帮助,但 Snoop 是调试 WPF 应用程序的绝佳工具。
这也与您提到的问题有点无关,但我还发现您在使用 WPF 时需要密切关注内存使用情况(尤其是当您开始使用时),因为很容易保留意外的引用到物体。 Red Gate 的内存分析器 是一个令人惊叹的工具。
This may not help with your particular problem, but Snoop is a great tool for debugging WPF applications.
This is also a bit unrelated to the issue you mentioned, but I've also found that you need to keep an eye on memory usage when working with WPF (especially when you're getting started), since it's pretty easy to keep unintended references to objects. Red Gate's memory profiler is an amazing tool for this.
嗯,没有什么比在 Visual Studio 中调试 ac# 代码更复杂的了,但是有几种方法;
http://rrelyea.spaces.live.com /Blog/cns!167AD7A5AB58D5FE!1625.entry
http: //geekswithblogs.net/lbugnion/archive/2007/03/14/108728.aspx
http://blogs.devsource.com/devlife/content/silverlight/debugging_dynamic_xaml_in_silverlight_1。 html
Well, there is nothing as sophisticated as debugging a c# code in visual studio, but there are a few ways;
http://rrelyea.spaces.live.com/Blog/cns!167AD7A5AB58D5FE!1625.entry
http://geekswithblogs.net/lbugnion/archive/2007/03/14/108728.aspx
http://blogs.devsource.com/devlife/content/silverlight/debugging_dynamic_xaml_in_silverlight_1.html