好吧我在一个简单的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,请查看以下链接:
weblogs.asp/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx
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:
weblogs.asp/scottgu/pages/silverlight-tutorial-part-5-using-the-listbox-and-databinding-to-display-list-data.aspx
更多推荐
将IList绑定到ListBox
发布评论