WPF Tips: ListBox显示ItemsSource中对象的属性

与ListBox的ItemsSource为一个List<MyClass>, 但只想在ListBox中显示MyClass的属性MyName。

cs:

this.ListBox1.ItemsSource = MyClassList;
this.ListBox1.DisplayMemberPath = "MyName";

 

posted @ 2016-04-28 10:42  Jane&Coding  阅读(650)  评论(0)    收藏  举报