-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Unable to select same item twice in a CollectionView #12491
Comments
Hi, @snowman745 - thanks for submitting this issue. The expected behavior for Try adding something like this in your Closing this issue, but if I misunderstood what's happening, please feel free to reopen with a sample project attached! Thanks :) |
Hi, as stated in my repro, I am setting selectedItem to null. This is what's broken. I even tried it as you stated: ((CollectionView)sender).SelectedItem = null; |
How do I reopen this? |
@snowman745 Happy to keep looking at this! I followed the steps you described and was able to get it working with |
Can you try your project on UWP? It tried and it works as expected on Android. If you cannot repro on UWP, ill upload a sample project. Thanks. |
Same problem here. Works on Android, not on UWP. |
Any update on this? |
Hi is there a workaround? Or any Updated? |
Hi, I have the same problem! this is a real issue on UWP |
Hi, I have the same problem! this is a real issue on UWP |
I solve this bug using stacklayout bindable items source and set gesture tapped for item <StackLayout BindableLayout.ItemsSource="{Binding User.TopFollowers}" |
@snowman745 This still exists in Xamarin.Forms 5.0.0.2012. @rachelkang I guess this is expected behavior. The real problem is that every damned web page out there suggests the code below:
Well, the above code causes the So, if one needs to set the selected item to
And that's all there is to it, really. Historically speaking, this exact same kind-of-control-behavior dates back to Visual Basic 6. Oh, well... |
Result: SelectionChanged event not fired.
Note: I even set SelectedItem = null but this does not help.
private void CollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
FriendViewModel selectedItem = (FriendViewModel) FriendsCollectionView.SelectedItem;
if(selectedItem != null)
{
ViewFriend(selectedItem.FriendId);
FriendsCollectionView.SelectedItem = null;
}
}
Xamarin Forms version 4.8.0.1534
Visual Studio Version 16.7.5
NOTE: Repro'd on UWP, does NOT repro on Android.
Repro:
CollectionViewSingleSelectionDemo.zip
The text was updated successfully, but these errors were encountered: