Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DataGrid can't select or edit when rows matches in equality #16834

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ionite34
Copy link

@ionite34 ionite34 commented Aug 27, 2024

What does the pull request do?

Fixes #13894 (When a DataGrid have two or more rows with same content that match the Equals with true against the other element, those can't be selected nor edited.)

What is the current behavior?

DataGrid using DataGridCollectionView as ItemSource with items that implements IEquatable with each other and are equal (e.g. default record objects as blank rows) are not selectable and not editable.

What is the updated/expected behavior with this PR?

DataGrid can now have rows items that implement IEquatable and are equal with other rows without causing edit / selection issues.

How was the solution implemented (if it's not obvious)?

Changes some previous usages of Object.Equals and == to Object.ReferenceEquals

Checklist

Breaking changes

N/A. Since previously the DataGridCollectionView wasn't deduplicating items that are equal, instead allowing them to be added but not be editable or selectable, I doubt anyone is using this as intended behavior.

Obsoletions / Deprecations

N/A.

Fixed issues

Fixes #13894

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051517-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Aug 27, 2024

  • All contributors have signed the CLA.

@ionite34
Copy link
Author

@cla-avalonia agree

@ionite34 ionite34 marked this pull request as draft September 4, 2024 19:12
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051658-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataGrid can't select/edit rows where an element match other element Equality
3 participants