Skip to content

[Windows] - Fix Grid layout not updating when Row/Column changed dynamically #30206

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

prakashKannanSf3972
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause

  • When Grid.Row or Grid.Column properties are updated on a Grid element nested within another Grid, the current implementation only invalidates the element itself and does not propagate the invalidation to its parent. As a result, the parent layout is not re-measured or arranged correctly, leading to inaccurate or incomplete rendering.

Description of Change

  • Improved parent layout invalidation for Grid on Windows to ensure UI updates correctly when Grid.Row or Grid.Column properties change.

Issues Fixed

Fixes #20404

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output

Before After
BeforeFix_Grid.mp4
AfterFix_Grid.mp4

Copy link
Contributor

Hey there @@prakashKannanSf3972! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jun 25, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prakashKannanSf3972 prakashKannanSf3972 marked this pull request as ready for review June 27, 2025 07:02
@Copilot Copilot AI review requested due to automatic review settings June 27, 2025 07:02
@prakashKannanSf3972 prakashKannanSf3972 requested a review from a team as a code owner June 27, 2025 07:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that dynamic changes to Grid.Row and Grid.Column on Windows correctly invalidate the parent layout so the UI updates without requiring a window resize.

  • Added a UI sample page in the HostApp for toggling row/column at runtime.
  • Added a cross-platform UI test in TestCases.Shared.Tests to verify dynamic grid updates.
  • Updated Grid.cs to propagate measure invalidation to the parent grid on Windows.

Reviewed Changes

Copilot reviewed 3 out of 11 changed files in this pull request and generated 2 comments.

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20404.cs New UITest verifying dynamic row/column toggles trigger layout updates.
src/Controls/tests/TestCases.HostApp/Issues/Issue20404.cs New sample page with buttons to toggle grid row/column dynamically.
src/Controls/src/Core/Layout/Grid.cs Updated Invalidate method to explicitly invalidate parent grid on Windows.

if (grid.Parent is Grid containerGrid)
{
containerGrid.InvalidateMeasure();
return;
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

Returning immediately after invalidating the parent skips the grid's own InvalidateMeasure call. To guarantee both the grid and its container are re‐measured, consider calling grid.InvalidateMeasure() before or after invalidating the parent instead of exiting early.

Suggested change
return;
grid.InvalidateMeasure();

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution layout-grid partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing Grid.Row does not update layout until window is resized
2 participants