PagedCollectionView, Unsupported type of source for a collection view

PagedCollectionView, Unsupported type of source for a collection view

Old forum URL: forums.lhotka.net/forums/t/9932.aspx


hanspret posted on Tuesday, January 11, 2011

Hi

I am using silverlight CSLA 4.1. In my viewmodel I get an "Unsupported type of source for a collection view" exception whenever I initialize a PagedCollectionView and call the OnPropertyChanged method. The exception actually happens on the ViewModelBase class on the OnPropertyChanged method. Can someone tell me what I am doing wrong?

private PagedCollectionView _DepreciationList;

public PagedCollectionView DepreciationList

{

get

{

if (_DepreciationListBase == null)

{

if (SelectedPeriod != null)

{

Business.DepreciationDisplayCollection.GetDepreciationDisplayCollectionAll(SelectedPeriod.Period, SelectedPeriod.Year, (e, o) =>

{

_DepreciationListBase = new ObservableCollection<DepreciationDisplay>();

Business.DepreciationDisplayCollection depCollection;

depCollection = o.Object;

foreach (var item in depCollection)

{

_DepreciationListBase.Add(item);

}

_DepreciationList = new PagedCollectionView(_DepreciationListBase);

OnPropertyChanged("DepreciationList");

 

});

}

}

return _DepreciationList;

}

 

}

RockfordLhotka replied on Thursday, January 13, 2011

It sounds like your resource object is a CollectionViewSource, and you are setting its Source property to this viewmodel property value?

If that's true, the exception seems to be indicating that CVS.Source can't be set to a PagedCollectionView object.

Copyright (c) Marimer LLC