Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

MvxListView with header and multiple choise offset selection by one

$
0
0

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;

    }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>