Hello,
MAUI do not have reset event method to do it, but if you can make the selected item to null to reset the selected item.
For example, we have two Collectionviews. I add SelectionChanged
event for these two Collectionviews. if the Collectionview1 item selected, Collectionview2 selected item will be set null, vice versa. You can refer to the following code. As Note: My SelectionMode of Collectionview is Single.
public YourPage()
{
InitializeComponent();
MyCollectionview1.SelectionChanged += MyCollectionview1_SelectionChanged;
MyCollectionview2.SelectionChanged += MyCollectionview2_SelectionChanged;
}
private void MyCollectionview2_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (e.CurrentSelection != null )
{
if (e.CurrentSelection.Count==0)
{
return;
}
if (MyCollectionview1.SelectedItem == null)
{
return;
}
else
{
MyCollectionview1.SelectedItem = null;
}
}
}
private void MyCollectionview1_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (e.CurrentSelection!= null)
{
if (e.CurrentSelection.Count == 0)
{
return;
}
if (MyCollectionview2.SelectedItem == null)
{
return;
}
else
{
MyCollectionview2.SelectedItem = null;
}
}
}
Best Regards, Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.