数据绑定失败
我有一个包含 30 个数据字段的表单 - 主要是显示字符串数据的 TextBox 控件,但有 3 个下拉列表组合框和一个用于显示日期时间的文本框。 我使用 BindingSource 将这些字段绑定到从 BindingList<> 派生的自定义数据对象。
根据数据源中数据的内容,有时特定字段将无法绑定 - 这意味着来自数据源的数据不会移动到控件。 失败的控件是一个简单的 textbox.text / string 绑定。
我可以执行一个特定的查询,该查询在每个实例中都会导致该特定字段无法绑定。 我还有其他可以执行的查询,这些查询会生成一组数据,其中绑定都可以完美运行。
我的问题是 - 是什么导致数据绑定失败? 其他某个绑定字段的失败是否会阻止所有其他绑定触发?
I have a form with 30 fields of data on it - mostly TextBox controls displaying string data, but there are 3 dropdownlist comboboxes and one textbox used to display a datetime. I'm using a BindingSource to bind these fields to a custom data object derived from BindingList<>.
Depending on the content of the data in the data source, sometimes a specific field will simply fail to bind - meaning the data from the data source does not get moved to the control. The control that fails is a simple textbox.text / string binding.
I can perform a specific query that in every instance will cause this specific field to fail to bind. I have other queries that can be performed that produce a set of data where the bindings all work perfectly.
My question is - what causes data binding to fail? Will the failure of some other bound field stop all the other bindings from firing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以检查以下几项内容:
Here are a few things that you could check
我通过编写自己的绑定基础结构解决了这个问题。 这使我能够更明确地控制绑定何时触发以及结果发生的情况。
I solved this issue by writing my own binding infrastructure. That gave me more explicit control over when bindings fired and what happened as a result.