将IList绑定到ListBox

编程入门 行业动态 更新时间:2024-10-19 22:21:57
本文介绍了将IList绑定到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,请查看以下链接:

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

本文发布于:2023-11-06 14:12:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563912.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   IList   ListBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!