数据绑定到派生数据类型 [英] Databinding to a derived data type
本文介绍了数据绑定到派生数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出底部的代码,并使用2个不同的Windows应用程序,将其绑定到组合框时会得到不同的结果.
- Windows App 1可以正常工作,并显示值1,2,3.
- Windows App 2显示ToString()输出"WcfService.Child".对于每个项目.使用VS Debugger,我可以检查从服务返回的数据,并可以看到属性"B"已被删除.值1,2,3在那里.
- The Windows App 1 works as expected and will display values 1,2,3.
- The Windows App 2 displays the ToString() output "WcfService.Child" for each of the items. Using VS Debugger, I can examine the data coming back from the service and can see that the property "B" and the values 1,2,3 are there.
任何想法都会受到赞赏.
戴夫
Windows App 1:直接数据绑定,不涉及WCF.
comboBox1.DataSource = MyData .GetData()[ " Child" ];
comboBox1.DisplayMember = "B" ;
comboBox1.DataSource = MyData.GetData()["Child"];
comboBox1.DisplayMember = "B";
推荐答案
标记为已死.
这篇关于数据绑定到派生数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文