views:

12

answers:

1

i am working with an pageCollectionin silverlight ,i have some remove and addition work in to the pagedviewcollection's object

i was able to remove from collection as below

_pageCollection.RemoveAt(_index);

but i am not able add an item to the pageCollection .how to add an item to the _pageCollection. i feel it should be dealt with below code

_pageCollection.AddNew();

but i amnot able to get how to proceed?

A: 

If you use a PagedCollectionView you have to set a source IEnumerable. If you add it to this collection it will work (assuming that your PCV is working with a list of Products which have an id).

myPagedCollectionView = new PagedCollectionView(myCollection);
myCollection.Add(new Product(){Id=5});

If you work with AddNew you have to do it like this :

var obj = (Product)myPagedCollectionView.AddNew();

obj.Id = 5;

Hope this is what you needed.

TerenceJackson