我正在我的应用程序中实现一个本地SQLite数据库,当它应该有一个图像名称列表,如“image1.png”,“image2.png”,“image3.png”等时,我的Observablecollection似乎返回空该模型如下:
public class ImageDB
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string ImageName { get; set; }
public string ImageSource { get; set; }
public string Description { get; set; }
}
我基本上试图像这样填写Oberservablecollection:
var myList = await App.Database.GetChinsAsync();
FeaturesChangerSource = new ObservableCollection<string>(myList.Select(x =>
x.ImageSource.ToString()).ToList());
使用此方法:
public Task<List<ImageDB>> GetChinsAsync()
{
return database.QueryAsync<ImageDB>("SELECT * FROM tImages WHERE Description
LIKE '%chin%'");
}
财产变更通知:
private ObservableCollection<string> _featuresChangerSource;
public ObservableCollection<string> FeaturesChangerSource
{
get { return _featuresChangerSource; }
set { _featuresChangerSource = value; OnPropertyChanged(); }
}
有关Observablecollection为何为空的任何见解?