如何在 .NET Compact Framework 中模拟 ErrorProvider?
由于.NETCF中没有ErrorProvider类,我如何实现类似的功能(不一定完全像ErrorProvider一样)?
我正在使用所有常规数据绑定构造将控件绑定到数据表,使用 DataRow.RowError 属性和 DataRow.SetColumnError 方法,但我无法在任何 DataTable、BindingManagerBase 等上找到可以连接以接收的事件任何类型的通知。
我是否坚持调用一个方法来手动迭代表单上的所有控件并更改绑定控件的某些外观/感觉?
谢谢, 先生B
Since there is no ErrorProvider class in .NETCF, how can I implement similar functionality (not necessarily exactly like ErrorProvider)?
I am using all the regular databinding constructs to bind controls to a datatable, using the DataRow.RowError property and DataRow.SetColumnError method, but I can't find events on any of DataTable, BindingManagerBase, etc. that I can hook into to receive any sort of notification.
Am I stuck calling a method to manually iterate through all the controls on my form and change some look/feel of the bound control?
Thanks,
MrB
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ErrorProvider
类看起来非常基础——实际上,有点太基础了。 如果您有Red Gate Reflector,我建议您拆解该类并查看它。 否则,创建一个Dictionary
。以下是创建您自己的提供程序的快速想法:
我这里没有 RG 反射器,否则我会提供更多示例方法。 但这应该提供某种可供参考的样本。
The
ErrorProvider
class seems pretty basic - actually, a little too basic. If you have Red Gate Reflector, I would recommend disassembling the class and looking at it. Otherwise, create aDictionary<Control, String>
.Here is a quick idea on creating your own provider:
I don't have R-G reflector here or I would provide more sample methods. But this ought to provide some sort of sample to work from.