【发布时间】:2010-01-15 00:55:04
【问题描述】:
我有一个 Windows 窗体 (net 2.0),其上的控件通过 BindingSource..works 绑定到实体 (w/INotifyPropertyChanged)。
在同一个表单上,我有一个下拉列表,它也通过 BindingSource..works 连接起来
以下是相关代码的示例:
m_PlanItemLookupBindingSource.DataSource = GetBusinessLogic().RetrievePaymentPlanLookups(); // Collection of PaymentPlans
paymentPlanType.Properties.DataSource = m_PlanItemLookupBindingSource;
paymentPlanType.Properties.DisplayMember = "Name";
paymentPlanType.Properties.ValueMember = "ID";
paymentPlanType.DataBindings.Add(new Binding("EditValue", m_PlanBindingSource, "PaymentPlanID", true, DataSourceUpdateMode.OnPropertyChanged, null, "D"));
agencyComission.DataBindings.Add(new Binding("EditValue", m_PlanBindingSource, "AgencyCommission", true, DataSourceUpdateMode.OnPropertyChanged, null, "P1"));
billingType.DataBindings.Add(new Binding("Text", m_PlanBindingSource, "BillingType"));
因此,当我更改下拉列表中的值时,我认为 m_PlanItemLookupBindingSource Current 属性会随着发生更改的实体的 PaymentPlanID 属性一起更改。
有点困惑。
提前致谢, 斯蒂芬
【问题讨论】:
标签: winforms data-binding