当我选择itemFooter时,数据绑定将获取数据并加载继续
public void getFeed()
{
waittingopen();
if (listRSS != null && listRSS.Count > 0)
{
List<Article> listArticle = getArticle();
if (listArticle.Count > 0)
{
if (loadmor != null && list.Items.Contains(loadmor))
{
list.Items.Remove(loadmor);
}
#region add item
for (int i = 0; i < listArticle.Count; i++)
{
dataDetail dataDetail;
if (i == 0 && dtListBoxx.Count == 0)
dataDetail = new dataDetail { title = listArticle[i].title, feedName = listRSS[indexLoadmor].name, Type = "itemBigContent", isVisileLineLeft = System.Windows.Visibility.Collapsed, isVisileBook = System.Windows.Visibility.Collapsed };
else
dataDetail = new dataDetail { title = listArticle[i].title, feedName = listRSS[indexLoadmor].name, Type = "itemContent", isVisileLineLeft = System.Windows.Visibility.Collapsed, isVisileBook = System.Windows.Visibility.Collapsed };
dtListBoxx.Add(dataDetail);
}
#endregion
if (intLoad == 0)
{
listArticle.Clear();
listArticle = null;
indexLoadmor++;
intLoad++;
getFeed();
}
else
{
intLoad = 0;
dataDetail dataLoadmoreItem = new dataDetail { Type = "itemFooter" };
dtListBoxx.Add(dataLoadmoreItem);
this.list.ItemsSource = dtListBoxx;
}
waittingClose();
}
else
{
getfeed = new Getfeed(listRSS[indexLoadmor].link.ToString(), "", listRSS[indexLoadmor].rid, intLoad);
getfeed.onComplete += new Getfeed.DownloadComplete(getfeed_onComplete);
if (intLoad == 1)
intLoad = 0;
}
}
}
如何使用this.list.ItemsSource = dtListBoxx加载更多数据?我试过但是当dataDetail添加项目时,listbox没有更新
请帮助我!
答案 0 :(得分:0)
使用ObservableCollection
代替List
。它会自动引发OnCollectionChanged
事件,以通知视图集合中发生了一些更改。