XamarinCommunityToolkit
XamarinCommunityToolkit copied to clipboard
[Bug] Hard to select ListView's items when used in TabViewItem
Description
When using ListView in TabViewItem, after change tab, it's hard to select ListView's items
Link to Reproduction Sample
https://github.com/ghuynguyen/tabview_bug
Steps to Reproduce
- Switch to Tab 2
- Switch back to Tab 1
- Select an item in ListView
Expected Behavior
Item selected by 1 tap
Actual Behavior
Item selected by multi tap
Basic Information
- Version with issue: 1.3.1, 2.0.1
- Last known good version:
- IDE: Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.1.0
- Platform Target Frameworks:
- iOS: not test
- Android: 11
- Nuget Packages:
- Xamarin.Community Toolkit 1.3.1
- Xamarin.Community Toolkit 2.0.1
- Xamarin.Forms 5.0.0.2337
- Affected Devices: Tested on Android Emulator API 28( Android 9 ) and Physical Android 11
Workaround
Refresh the list at TAB 1 when switch to TAB 2 and vice versa.
Reproduction imagery

i have same issue, any updates on this ?
Update: This bug only appears on Android. Works fine on iOS
Workaround
In my case, using the MVVM pattern, when the TAB index changes (TabView.SelectedIndex), it is sufficient to update the ItemSource of the ListView by calling OnPropertyChanged(nameof(ListItemSource)), for example, when the ListView is specified as: ItemSource="{Binding ListItemSource}".
This allows fixing the bug depicted in the video issue for android too.