【发布时间】:2009-06-16 12:53:11
【问题描述】:
我正在尝试将 SubSonic 2.1 生成的 DAL 对象绑定到 WinForm (VB.NET VS2005)。为了解决缺少 IPropertyNotifyChanged 实现的问题,在我的绑定方法中,我在我要绑定的每个控件的 controlname.DataBindings.Add() 之前执行 controlname.DataBindings.Clear()。
文本框可以很好地处理这样的代码(ioBLL 是对我的 BLL 对象的引用,ioDAL 是对其中的 DAL 属性的引用):
txtCountryName.DataBindings.Add(New Binding("Text", ioBLL.ioDAL, namespace.Country.Schema.Columns.GetColumn("CountryName").ToString, True, DataSourceUpdateMode.OnPropertyChanged))
但是当绑定到一个复选框时
chkObsolete.DataBindings.Add(New Binding("Checked", ioBLL.ioDAL, namespace.Country.Schema.Columns.GetColumn("Obsolete").ToString, True, DataSourceUpdateMode.OnPropertyChanged))
当底层属性值为 True 时,它永远不会在运行时出现勾选。
有什么想法吗?
【问题讨论】: