Reputation: 195
I want to copy the record from one IEnumerable to another after checking the index of the record. pvm consists of set of records with n number of columns and m number of rows. In view_filter method i am checking index. If the condition holds good I want to copy record to _invMstrSrchResults. Index gets checked one by one.
public PagingViewModel(IEnumerable<InventoryMasterItem> pvm)
{
ViewList = new CollectionViewSource();
ViewList.Source = pvm;
ViewList.Filter += new FilterEventHandler(view_Filter);
CurrentPageIndex = 0;
itemcount = 100;
CalculateTotalPages();
}
private IEnumerable<InventoryMasterItem> _invMstrSrchResults;
void view_Filter(object sender, FilterEventArgs e)
{
int index = ((InventoryMasterItem)e.Item).indexNo - 1;
if (index >= itemPerPage * CurrentPageIndex && index < itemPerPage * (CurrentPageIndex + 1))
{
// I want to copy record from pvm to _invMstrSrchResults here
e.Accepted = true;
}
else
{
e.Accepted = false;
}
}
Upvotes: 0
Views: 82
Reputation: 160
FilterEventArgs
should be holding an InventoryMasterItem
object which you can retrieve in view_Filter
. Additionally, you may need to a create a different collection temporarily, List<InventoryMasterItem>
and then cast it to an IEnumerable<InventoryMasterItem>
:
InventoryMasterItem item = e.Item as InventoryMasterItem;
var list = new List<InventoryMasterItem>();
list.Add(item);
_invMstrSrchResults = list.AsEnumerable();
Upvotes: 1