My grid:
<dxg:GridControl x:Name="StatisticsGridLevel1"
dx:ThemeManager.ThemeName="Office2013"
DataContext="{Binding FooViewModel}"
ItemsSource="{Binding FooCollection}">
ViewModel:
private List<FooDto> fooCollection = new List<FooDto>();
public List<FooDto> FooCollection
{
get
{
return this.fooCollection;
}
private set
{
this.fooCollection = value;
this.NotifyPropertyChanged();
}
}
And example method:
private void Foo()
{
foreach (var element in collection)
{
this.fooCollection.Add(new FooDto()
{
X = element.Foo1,
Y = element.Foo2,
Z = element.Foo3
});
}
this.NotifyPropertyChanged("FooCollection");
}
When I use ObservableCollection, everything works fine. But I want to use the List (that's not to notify in the loop).
The view refreshes after the start scroll on the grid. What is the problem?
ObservableCollection? The grid is not going to update automatically when the collection is modified unless the collection implementsINotifyCollectionChanged.ObservableCollectionimplements that interfaceListdoes not. - Jason BoydFoodespite the fact that you are using aListinstead of anObservableCollection? Is that right? - Jason Boyd