开发者

Must resize window for items to show

I have a ListView which I have bound with a List. If I add items to the List I must resize my window for the 开发者_如何学JAVAitems to appear in my ListView.

Any ideas?


Make sure your list implements INotifyCollectionChanged. You may want to use ObservableCollection<T> here, as it makes this easy.

If you are binding to a standard List<T>, there is no way for the binding system to know that the list's contents have changed. My guess is that, when you resize the window, the list is rechecking the binding (in order to perform the new layout correctly), and capturing the new elements. Until you do this, the list's binding never refreshes. INotifyCollectionChanged will fix that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜