将IList绑定到ListBox [英] Binding an IList to a ListBox
问题描述
好吧我在一个简单的Silverlight控件上有一个Listbox。我进行WCF服务调用以获取填充了Entity框架类的IList。
代码:
//加载结果
IList < tbl_Manufacturer
> manufacturerList = e.Result;
lstCustomers.ItemsSource = manufacturerList ;
当
运行时确实在IList中取回了正确的结果(用for循环验证),但是当设置绑定时,我在页面上得到的值是"< Classname> .tbl_Manufacturer"它不会从IList加载值。
我相信
这是一个完全没有问题的问题,但任何人都知道我错过了什么。我的Google / Bing kung foo现在让我失望。
您必须定义ItemTemplate,请查看以下链接:
Alright I got a Listbox on a simple Silverlight control. I makes a WCF service call to grab an IList filled with an Entity framework class.
Code:
//load results
IList<tbl_Manufacturer
> manufacturerList = e.Result;
lstCustomers.ItemsSource = manufacturerList;
When this runs it does pull back the proper results in the IList (verified with a for loop), but when the binding is set all I get on the page is the value "<Classname>.tbl_Manufacturer" It does not load the values from the IList.
I am sure this a completely noob question but anyone know what I am missing. My Google/Bing kung foo is failing me right now.
You have to define the ItemTemplate, check out the below link:
这篇关于将IList绑定到ListBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!