I am using the example provided here StackOverflow related question, if i have an even number of items in the grid then it works all good, but if for instance i have an odd
The issue is not with GetItemAt
method, leave it as it was:
public override object GetItemAt(int index)
{
var offset = index % (this._itemsPerPage);
return this._innerList[this.StartIndex + offset];
}
The problem is with Count
property override. In case it is the last page it should return the correct items left:
public override int Count
{
get
{
//all pages except the last
if (CurrentPage < PageCount)
return this._itemsPerPage;
//last page
int remainder = _innerList.Count % this._itemsPerPage;
return remainder == 0 ? this._itemsPerPage : remainder;
}
}