绑定错误代码的含义是什么,我在哪里可以找到它们的列表?

Rac*_*hel 6 wpf binding

当我在WPF中收到绑定错误时,会出现一个错误代码.

例如,

System.Windows.Data 错误:40:BindingExpression路径错误:'object'''ProductModel'(HashCode = 57788087)'上找不到'Product'属性.BindingExpression:路径=产品; DataItem ='ProductModel'(HashCode = 57788087); target元素是'TextBox'(Name =''); target属性是'Text'(类型'String')

要么

System.Windows.Data 错误:4:无法找到绑定源,引用'RelativeSource FindAncestor,AncestorType ='System.Windows.Controls.ItemsControl',AncestorLevel ='1''.BindingExpression:路径= Horizo​​ntalContentAlignment; 的DataItem = NULL; target元素是'MenuItem'(Name =''); target属性是'Horizo​​ntalContentAlignment'(类型'Horizo​​ntalAlignment')

这些错误代码代表什么,我在哪里可以找到它们的列表?

Jef*_*ado 7

我不认为你会在任何地方找到官方来源或文档,这些似乎是程序集内部的消息和代码PresentationFramework.

这可能不是找到所有可能错误的唯一地方,但是如果你有一个像.NET Reflector这样的工具或者有可用的源代码,你可以查看MS.Internal.TraceData该类,你会在那里找到你的错误消息和代码.

例如,TraceData.ClrReplaceItem()对应于错误40TraceData.NoSource()对应于错误4.

TraceData类没有出现在参考源但它指出,产生的方法(我们感兴趣的那些)休息.上市文件AvTraceMessage.txt,并genTraceStrings.pl似乎没有被包括在内.因此,在我们访问这些文件之前,您必须检查程序集.