有没有办法有效地调试 WPF 数据绑定? [英] Is there any way to effectively debug WPF data bindings?

查看:27
本文介绍了有没有办法有效地调试 WPF 数据绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了数据绑定问题(一个单独的问题),通常在我编码时,我可以使用调试器单步执行,并点击断点.可能是一个简单的问题困扰了我一整天,没有解决方案(现在非常沮丧),因为我不知道如何在我的 XAML 数据绑定上运行调试器".

I am having a data binding problem (a separate question), and normally when I code, I can use the debugger to step through, and hit break points. What is probably a simple issue has taken me all day, with no resolution (getting very frustrated now), because I do not know how to "run the debugger" on my XAML data bindings.

如果有人能解释如何做到这一点,将不胜感激.

If anyone could explain how to do this, it would be greatly appreciated.

推荐答案

我不知道 VS 是否提供了一种简单的方法来调试绑定,但我通常使用 Snoop 用于调试绑定

I have no idea if VS provides an easy way to debug bindings, but I usually use Snoop for debugging bindings

这是一个工具,它将通过 WPF 应用程序并为您提供应用程序可视树的 TreeView.您可以选择一个元素来查看其 DataContext 和其他属性.如果有任何绑定错误,通常会突出显示该属性并说明错误是什么.如果由于属性不存在而导致绑定失败,我通常可以跟踪 DataContext 并找出我在绑定中出错的地方.

It's a tool that will go through a WPF application and give you a TreeView of the application's Visual Tree. You can select an element to view its DataContext and other properties. If there are any binding errors, the property is usually highlighted and it will say what the error was. If the binding is failing because the property doesn't exist, I can usually trace the DataContext and figure out where I went wrong in my binding.

这篇关于有没有办法有效地调试 WPF 数据绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆