-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Enhancement] Allow to maually deselect item from CollectionView #6158
Comments
I am using a workaround. I have added a Tapped event handler to the ItemTemplate and using this code
|
Once PR #6085 is merged, setting |
…orrectly (#6085) * Add automated test for CollectionView single selection bound item * Make SelectedItem Two-Way * Multiple selection test page * Bindable SelectedItems implementation * Add automated test * Simplify null checks * Add Preserve attribute so linker doesn't break test * Make multi-item select test smaller so it passes UITests on smaller screens * Clearer list-to-string method * Clear native selection on iOS when SelectedItem set to null fixes #6158 fixes #5832
this seems not to work anymore for me |
setting the selected item to null dosnt reset the selection |
@BrayanKhosravian Which version of Forms? And on which platform? |
Wow that was a very fast response. Thanks :D Latest stable release of xamarin forms (4.4.0.99142). But before you invest some time to investigate, let me check it one more time. Is it fine for you to notify you here? |
im online on gitter as well |
This is always the correct place for that. Also, since you said it was happening on UWP, I wonder if you're seeing this bug: #8842 |
oh yes its exactly the bug. private void IngredientSelected(object sender, SelectedItemChangedEventArgs e)
{
if(e is null) return;
((CollectionView) sender).SelectedItem = null;
e.CurrentSelection = null;
IngredientCollectionView.SelectedItem = null;
} |
but none worked actually. i tought that i made a mistake in my source. |
I had the same problem and found a solution by wrapping the SelectedItem = null in a UI call for UWP: I'm working with a ViewModel with a TwoWay Binded SelectedItem |
This solved my issue |
Summary
In many scenarios developer would require to programmatically needs to deselect a selected item. I tried to do so by binding SelectedItem to a property in ViewModel. I am assigning it a value of null to deselect the selected item. But that does not work.
The text was updated successfully, but these errors were encountered: