Skip to content

Fix DataGrid SelectionChanged event not raised after 3 right clicks #6948

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

Merged

Conversation

dorufoaltin
Copy link
Contributor

@dorufoaltin dorufoaltin commented Nov 15, 2021

What does the pull request do?

Fix DataGrid.SelectionChanged event not raised after you right click 3 different rows.

What is the current behavior?

Currently after 3 right clicks on different rows, the SelectionChanged event is not raised anymore for neither left or right click on any of the data grid's rows.

From a code perspective, the NoSelectionChangeCount is decremented, without initially being incremented, in the method UpdateStateOnMouseRightButtonDown. This will set the NoSelectionChangeCount to be negative (-1 on first right click, -2 on 2nd right click, etc), and after 3 right clicks, the NoSelectionChangeCount will never reach 0 value, which would have raised the event.

What is the updated/expected behavior with this PR?

After multiple right clicks on different DataGrid rows, the SelectionChanged event is still fired after left or right click on a row.

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

Added the (missing) increment in the UpdateStateOnMouseRightButtonDown method.

Fixed issues

#6898

@dnfadmin
Copy link

dnfadmin commented Nov 15, 2021

CLA assistant check
All CLA requirements met.

@maxkatz6 maxkatz6 enabled auto-merge January 7, 2022 07:28
@maxkatz6 maxkatz6 merged commit 2ca907a into AvaloniaUI:master Jan 7, 2022
donandren pushed a commit to donandren/Avalonia that referenced this pull request Jan 11, 2022
…id-right-click-selection

Fix DataGrid SelectionChanged event not raised after 3 right clicks
ltetak pushed a commit to ltetak/Avalonia that referenced this pull request Jan 14, 2022
…ght-click-selection

Fix DataGrid SelectionChanged event not raised after 3 right clicks
maxkatz6 added a commit that referenced this pull request Jan 18, 2022
…selection

Fix DataGrid SelectionChanged event not raised after 3 right clicks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants