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

Grid fixes #15516

Merged
merged 2 commits into from
Apr 26, 2024
Merged

Grid fixes #15516

merged 2 commits into from
Apr 26, 2024

Conversation

zii-dmg
Copy link
Contributor

@zii-dmg zii-dmg commented Apr 25, 2024

What does the pull request do?

Fixes Grid.ShowGridLines usage - crash on false value and resize, not redraw Grid when changed.

What is the current behavior?

  1. Crash when set ShowGridLines = false and resize because GridLinesRenderer was added to VisualChildren instead of remove.
  2. Changing ShowGridLines to any value is not redrawing Grid because Grid was invalidating visual but not updating GridLinesRenderer. GridLinesRenderer updates in ArrangeOverride.

What is the updated/expected behavior with this PR?

No crash, correct redraw on ShowGridLines changed, bindings to ShowGridLines works.

Fixed issues

Fixes #11478

zii-dmg added 2 commits April 25, 2024 21:19
Fixed "System.InvalidOperationException: 'The control GridLinesRenderer already has a visual parent Grid (Name = grid) while trying to add it as a child of Grid (Name = grid).'" when set ShowGridLines = false and resize.
When changing ShowGridLines property GridLinesRenderer is not updating (create/remove/set bounds). Need to call InvalidateArrange -> ArrangeOverride -> EnsureGridLinesRenderer.
@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Apr 25, 2024

  • All contributors have signed the CLA.

@zii-dmg
Copy link
Contributor Author

zii-dmg commented Apr 25, 2024

@cla-avalonia agree

@avaloniaui-bot
Copy link

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

@jmacato jmacato requested a review from MrJul April 25, 2024 20:51
Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@MrJul MrJul added the backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch label Apr 26, 2024
@MrJul MrJul added this pull request to the merge queue Apr 26, 2024
Merged via the queue into AvaloniaUI:master with commit f0777a4 Apr 26, 2024
11 checks passed
maxkatz6 pushed a commit that referenced this pull request May 8, 2024
* Fixed ShowGridLines = false crash

Fixed "System.InvalidOperationException: 'The control GridLinesRenderer already has a visual parent Grid (Name = grid) while trying to add it as a child of Grid (Name = grid).'" when set ShowGridLines = false and resize.

* Fixed grid lines renderer (fixes ShowGridLines binding)

When changing ShowGridLines property GridLinesRenderer is not updating (create/remove/set bounds). Need to call InvalidateArrange -> ArrangeOverride -> EnsureGridLinesRenderer.
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels May 8, 2024
@zii-dmg zii-dmg deleted the grid-fixes branch May 22, 2024 16:16
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.

grid.ShowGridLines Binding doesn't work
5 participants