سؤال

I know that the Windows Phone 7 ListBox use VirtualizingStackPanel by default to optimize memory.

However, when I add more items to the view model, the listbox doesnot show those new items. I must scroll up, then down to see them.

My view model does implement IList

Many articles around have this problem, like this guide

How to fix this ?

هل كانت مفيدة؟

المحلول

Does you viewmodel implement the INotifyPropertyChanged interface and raise the PropertyChanged event when you've added more items?

A better solution is to make the viewmodel property you bind against an ObservableCollection. This class will automatically raise the PropertyChanged event when items are added/removed from the collection.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top