Fix DataGrid can't select or edit when rows matches in equality #16834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
usingDataGridCollectionView
asItemSource
with items that implementsIEquatable
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 implementIEquatable
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==
toObject.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