DevExpress LookUpEdit 行为
我为这个令人惊奇的问题而抓狂。
我从代码中绑定 2 个 LookUpEdit:
MyBinding.DataSource = typeof(MyObject);
MyBinding.DataSource = _dataObject.GetMyList();
firstLookUp.DataBindings.Add("EditValue", MyBinding, "Code");
firstLookUp.Properties.DataSource = MyBinding;
firstLookUp.Properties.ValueMember = "Code";
firstLookUp.Properties.DisplayMember = "Code";
secondLookUp.DataBindings.Add("EditValue", MyBinding, "Info");
secondLookUp.Properties.DataSource = MyBinding;
secondLookUp.Properties.ValueMember = "Info";
secondLookUp.Properties.DisplayMember = "Info";
第一个问题是:更改两个 LookUp 之一的值并没有反映出另一个 LookUp 的更改!但是我使用相同的BindingSource,位置不一样吗?
另一个是:它们都自动填充列,我不想显示所有列,尝试删除,未找到异常列,如果我添加,我会得到重复的列! 我不明白!
I'm tearing my hair off for this amazing problem.
I'm binding 2 LookUpEdit from code:
MyBinding.DataSource = typeof(MyObject);
MyBinding.DataSource = _dataObject.GetMyList();
firstLookUp.DataBindings.Add("EditValue", MyBinding, "Code");
firstLookUp.Properties.DataSource = MyBinding;
firstLookUp.Properties.ValueMember = "Code";
firstLookUp.Properties.DisplayMember = "Code";
secondLookUp.DataBindings.Add("EditValue", MyBinding, "Info");
secondLookUp.Properties.DataSource = MyBinding;
secondLookUp.Properties.ValueMember = "Info";
secondLookUp.Properties.DisplayMember = "Info";
First problem is: Changing the value on one of the two LookUps not reflecting changing the other one! But im using the same BindingSource, isn't the position the same?
Another one is: They both populate automatically the columns, i dont want to show all columns, tried to remove, exception column not found, if i add, i get duplicate columns!
I don't get it!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更改 LookupEdit 的 EditValue 并不直接绑定到 BindingSource.Current 位置。
您必须使用类似的方法,
如果您希望链接两个 LookupEdits,则最好在另一个更改时设置一个的编辑值。
其次,您应该能够像这样清除列列表:
Changing LookupEdit's EditValue is not directly bound to the BindingSource.Current position.
You have to use something like
If you want both LookupEdits linked you are probably better off setting the edit value of the one when the other is changed.
Secondly You should be able to clear the list of Columns like so:
正如这里所说
http://www.devexpress.com/Support/Center/p /B138420.aspx
http://www.devexpress.com/ Support/Center/p/A2275.aspx
LookupEdit 确实会更新 BindingSource 的 Current 属性。
我们使用以下代码作为解决方法:
As said here
http://www.devexpress.com/Support/Center/p/B138420.aspx
http://www.devexpress.com/Support/Center/p/A2275.aspx
LookupEdit does update the Current Property of the BindingSource.
We use the following Code as a workaround: