本文介绍了使用对象属性作为ListBox中的DisplayMember的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用对象内部的对象的属性.有没有办法做到这一点?
I want to use a property of an object that's inside an object.Is there a way to achieve this?
WebProxy proxy = new WebProxy("127.0.0.1:80");
ListBox listBox = new ListBox();
listBox.DisplayMember = **"Address.Authority"**; //Note: Address.Authority is an property inside the WebProxy object
listBox.Items.Add(proxy);
谢谢.
推荐答案
看看,本质上是在问同一件事-原理在DataGridView
和ListBox
之间不变.简短的答案:虽然可以,但是令人费解.
Have a look at this question, it is essentially asking the same thing - the principle does not change between DataGridView
and ListBox
. Short answer: it's possible, but convoluted.
这篇关于使用对象属性作为ListBox中的DisplayMember的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!