xamarin/Xamarin.Forms

ListView Item Selected changing, always looks up the index

オープン

#5,541 opened on 2019/03/13

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
a/listviewe/4 :clock4:help wantedinactivet/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Description

When you click on a row item in a ListView, it will lookup the index from the item source. The index is already known when the selection happens. Looking the index back up is a performance hit. Stack Trace:

  at gMusic.ViewModels.GroupedList`1[T].IndexOf (System.Object value) [0x00000] in /Users/clancey/Projects/LiveStream/gMusic/gMusic/ViewModels/SimpleDatabaseSource.cs:145 
  at Xamarin.Forms.ListProxy.IndexOf (System.Object item) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\ListProxy.cs:87 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].GetGlobalIndexOfItem (System.Object item) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:388 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].GetGlobalIndexOfItem (System.Object item) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:397 
  at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\ListView.cs:601 
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:624 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00179] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:422 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:367 
  at Xamarin.Forms.ListView.NotifyRowTapped (System.Int32 groupIndex, System.Int32 inGroupIndex, Xamarin.Forms.Cell cell) [0x0004c] in D:\a\1\s\Xamarin.Forms.Core\ListView.cs:441 

Steps to Reproduce

Expected Behavior

The IndexOf would never be called.

Actual Behavior

IndexOf is called on selection

Basic Information

コントリビューターガイド