Unselecting SelectedItem in MVVM by setting the binded property to null does work for iOS and Android for UWP it does not work.
My case: Selecting a Item navigates to another page. After navigating back the selection should be unselected.
SelectionChangedCommand:
private async void ArticleTeaserCollectionSelectionCommandMethod()
{
if(SelectedArticleTeaserItem != null && SelectedArticleTeaserItem != default)
{
await Navigation.PushAsync(new FullArticlePage(Navigation, new ArticleTeaser
{
Title = SelectedArticleTeaserItem.Title,
ArticleLink = SelectedArticleTeaserItem.ArticleLink,
Date = SelectedArticleTeaserItem.Date,
TeaserText = SelectedArticleTeaserItem.TeaserText,
TeaserImageLink = SelectedArticleTeaserItem.TeaserImageLink
}), true);
SelectedArticleTeaserItem = null;
}
}
Selection should be cleared for UWP
UWP Selection does not clear (iOS and Android works)
Xamarin.Forms 4.7
I have tried to reproduce the issue. Using SelectionChangedCommand
command I set SelectedItem
to null after one second.
What Xamarin.Forms version are you using?
@jsuarezruiz Here is a sample. As I wrote I does not work this way I showed.
Same issue but only with Selected
VisualSate defined. If VSM
not defined on CollectionView
, the item is unselected correctly. Related to PR https://github.com/xamarin/Xamarin.Forms/pull/10770
I'm also experiencing this issue, this also seems related to bug #12491
Most helpful comment
I'm also experiencing this issue, this also seems related to bug #12491