WPF 绑定到 IDataErrorInfo.Error 属性设计时问题
我想将 TextBox.Text 绑定到我的对象 IDataErrorInfo.Error 属性,该属性返回错误摘要。我的对象是 DataContext。 现在我有一个这样的文本框:
<TextBox xmlns:sys="clr-namespace:System.ComponentModel;assembly=System" Text="{Binding Path=(sys:IDataErrorInfo.Error), Mode=OneWay}" />
并且在运行时一切正常,但在设计时 Visual Studio 2010 显示错误:“Binding”上引发了 InvalidOperationException:对象“null”不能用作 PropertyPath 的访问器参数。访问器必须是 DependencyProperty、PropertyInfo 或 PropertyDescriptor。 现在出现此错误(在黄色栏中),我无法使用属性工具箱来编辑我的窗口。 任何人都可以帮我解决这个错误吗?
I want to Bind a TextBox.Text to my object IDataErrorInfo.Error property that return summary of errors. My object is DataContext.
Now i've a textbox like that:
<TextBox xmlns:sys="clr-namespace:System.ComponentModel;assembly=System" Text="{Binding Path=(sys:IDataErrorInfo.Error), Mode=OneWay}" />
and all works fine at runtime but at design time Visual Studio 2010 show an error: InvalidOperationException was thrown on "Binding": Object 'null' cannot be used as an accessor parameter for a PropertyPath. An accessor must be DependencyProperty, PropertyInfo, or PropertyDescriptor.
Now with this error (in yellow bar) i can not use property toolbox to edit my windows.
Anyone can help me solve this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能试试这个吗
<代码>
Text="{绑定路径=错误,模式=OneWay}"
Can you try this
Text="{Binding Path=Error, Mode=OneWay}"