[英]Binding data to a long list selector, C# WP8
我有一个数据库,我希望列出找到长列表选择器的所有项目,它目前有效,但它不显示实际文本,只是对象引用:
//this will return all the records found in file table
var query = context.Files;
//now execute the query
fileList = new ObservableCollection<FileTable>(query);
//set up list items.
llsEachItem.ItemsSource = fileList;
然后,长列表选择器只显示对象引用,对于每个项目而不是实际数据本身。 在这种情况下,它会显示以下列表:
Project.Model.FileTable
Project.Model.FileTable
Project.Model.FileTable
Project.Model.FileTable
Project.Model.FileTable
我怎样才能让它实际看到数据本身? 我已经尝试将toString()附加到fileList,但这似乎不起作用。 有什么建议么?
将列表中的DisplayMemberPath
设置为要在列表中显示的属性名称。
llsEachItem.ItemsSource = fileList;
llsEachItem.DisplayMemberPath = "PropertyName";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.