Skip to content

ListView.SelectedItem retains its value after item is removed from ListView or ListView is cleared #16053

@andrewstellman

Description

@andrewstellman

Description

The .NET MAUI ListView control's SelectedItem property retains a reference to an object even after the item has been removed or the ListView has been cleared.

Steps to Reproduce

  1. Add an object to a ListView
  2. Select the item in the ListView
  3. Either remove the item from the ListView or clear the ListView
  4. Call ListView.SelectedItem to get the currently selected item

Expected: ListView.SelectedItem returns null because no item is selected
Actual: ListView.SelectedItem returns a reference to the last selected object

Link to public reproduction project repository

https://github.com/andrewstellman/ListViewSelectedItemBug/

Version with bug

7.0.49

Last version that worked well

6.0

Affected platforms

Android, Windows, macOS

Affected platform versions

Reproduced on Windows, Android. MacCatalyst manifest 7.0.86/7.0.100 SDK 7.0.300

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-listviewListView and TableViewi/great-reporterThis issue is opened by an author who is known to open high-quality issuespartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androidplatform/macosmacOS / Mac Catalystplatform/windowss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions