我有一个wcf服务,它返回一个通用列表:List lstAccount。 我winforms应用程序中的表示层客户端使用代理对象来连接到此服务。从wcf响应到下拉列表的绑定集合
在代理,账户类被这样产生的:
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/Test.Common")]
public partial class Account {}
当我结合这个lstAccount在我的表现层的窗体上的下拉列表[通过设置DataSource属性],在下拉列表只显示了班级名称“帐户”而不是缩写帐户名称。
this.cblExistingAccounts.DataSource = lstAccount;
this.cblExistingAccounts.DisplayMember = "Name";
我在这里错过了什么?
谢谢。
当您测试在wcftestclient将WebMethod你得到的记录?客户端应该首先调用代理方法,我在这里没有看到... – sajoshi 2011-03-17 07:42:58
是的,我确实从服务获取记录。为简洁起见,我没有在此处添加该代码。 – Jimmy 2011-03-17 07:59:03