Xamarin.forms: ListView's GroupHeaderTemplate do not work with DataTemplateSelector on Android

Created on 26 Jul 2018  路  13Comments  路  Source: xamarin/Xamarin.Forms

version Xamarin.Forms.3.1.0.637273 and Xamarin.Forms 3.1.0.583944

I want to use the DataTemplateSelector for the GroupHeaderTemplate.

<ListView Grid.Row="1" ItemsSource="{Binding PickerGroups}" IsGroupingEnabled="True" ItemTemplate="{StaticResource PickerDataTemplateSelector}"
                  GroupHeaderTemplate="{StaticResource PickerDataTemplateSelector}"  CachingStrategy="RecycleElementAndDataTemplate">
</ListView>

I get here such a crash:

ListProxy.get_Item (System.Int32 index)
D:\a\1\s\Xamarin.Forms.Core\ListProxy.cs - line 127
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index

1 ListProxy.get_Item (System.Int32 index) D:\a\1\s\Xamarin.Forms.Core\ListProxy.cs:127
2 IList.get_Item (System.Int32 index) D:\a\1\s\Xamarin.Forms.Core\ListProxy.cs:444
3 ListViewAdapter.GetItemViewType (System.Int32 position) D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:172
4 BaseAdapter.n_GetItemViewType_I (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 position)
5 (wrapper dynamic-method) System.Object.cbacde75-f4e8-4fe2-bec7-81edead3c9fe(intptr,intptr,int)
listview 9 help wanted high in-progress inactive Android bug up-for-grabs

Most helpful comment

Yup that don't work.

All 13 comments

In version Xamarin.Forms.3.1.0.637273 there is also crash like this.

Yup that don't work.

Any updates?

@jassmith, @hartez @rmarinho @pauldipietro Any updates?

Maybe you help me help @jamesmontemagno

Nothing new ?

any updates?

You must attach a sample app which reproduces the issue

Seem's it's fixed

@samhouts can I close it?

@KSemenenko did it work for you in a new version? Which one is that?

@jfversluis nope I retested on 4.2.0.618605-pre2 it still exist.
but I got an idea for a slight improvement on DataTemplate #7082 so that I can try to fix this bug too

I created it, I will fix it

Was this page helpful?
0 / 5 - 0 ratings