I have an application that uses a MvxListView with a header control and it works greate untill I start selecting items. When I click on item two it selects item 1.
I have looked on this http://blog.masterdevs.com/headers-and-footers-on-an-mvxlistview/
My HeaderAdaptor implements IMvxAdapter and the GetRawItem looks like below. if I just return return _adapter.GetRawItem(position); the selection looks good but wrong value is selected and it will crash when selecting the last item.
Is there any way I can get around this.
public object GetRawItem(int position)
{
var wrappedAdapter = WrappedAdapter;
// Header (negative positions will throw an ArrayIndexOutOfBoundsException)
int numHeaders = HeadersCount;
if (position < numHeaders)
{
return -1;
}
// Adapter
int adjPosition = position - numHeaders;
int adapterCount = 0;
if (_adapter != null)
{
adapterCount = _adapter.Count;
if (adjPosition < adapterCount)
{
return _adapter.GetRawItem(adjPosition);
}
}
return -1;
}