Combobox数据绑定和 [英] Combobox Databinding And

查看:65
本文介绍了Combobox数据绑定和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的工作中,

Combobox.DataContex =从数据库中获取值。



而且我还想在没有分配DataContext Null或Combobox.Clear()的情况下为那个组合框添加一些额外的值。



怎么办?这个?

Hi,

In My Work ,
Combobox.DataContex = Getting Values From Database.

And I Also Want to Add Some Additional Values To That Combobox Without Assigning DataContext Null Or Combobox.Clear().

How Can Do This?

推荐答案

这样的事情可能会起作用;

Something like this might do the trick;
IList<yourtype> list = new List<yourtype>();
list.AddRange(GettingValuesFromDataBase());
list.AddRange(GetOtherValuesThatAlsoShouldBeInTheComboBox());
ComboBox.DataContext = list;
</yourtype></yourtype>





希望这会有所帮助,

Fredrik



Hope this helps,
Fredrik


你只需要更新DataSource。



Fedrik是对的,应该可以正常使用。
You just need to Update DataSource .

Fedrik is right it should work fine for you.


这篇关于Combobox数据绑定和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆