xamarin/Xamarin.Forms

ListView's GroupHeaderTemplate do not work with DataTemplateSelector on Android

Aperta

#3407 aperta il 26 lug 2018

 (14 commenti) (2 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/listviewe/9 :clock9:help wantedi/highin-progressinactivep/Androidt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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)

Guida contributor