我有一個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