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

Fixing UniformGridLayout items-per-line evaluation #4994

Merged
merged 2 commits into from
May 12, 2021

Conversation

RBrid
Copy link
Contributor

@RBrid RBrid commented May 11, 2021

Description

The UniformGridLayout class was incorrectly evaluating the number of displayed items per line. This caused occasional jumps when scrolling an ItemsRepeater in a ScrollViewer.

Motivation and Context

Another side effect of this bug is that requesting an offset change with ScrollViewer.ChangeView would result in an incorrect offset.

Introduced a new UniformGridLayout::GetItemsPerLine to evaluate the items-per-line value.
The old evaluation was ignoring the fact that when there are N columns, there are only N-1 separators in-between them and not N. This sometimes resulted in a smaller evaluated column count in a Horizontal layout.
The key code change is "+ MinItemSpacing()".

How Has This Been Tested?

Ad-hoc testing, new MuxControlsTestApp features for UniformGridLayout test page, new unit test with that page.

Without this fix, ScrollViewer.ChangeView(...1000...) would land at offset 1216 in the new test.

@RBrid RBrid requested review from StephenLPeters and ranjeshj May 11, 2021 20:22
@RBrid RBrid self-assigned this May 11, 2021
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 11, 2021
@RBrid
Copy link
Contributor Author

RBrid commented May 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj added team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels May 11, 2021
@RBrid
Copy link
Contributor Author

RBrid commented May 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@RBrid RBrid merged commit 1c07867 into main May 12, 2021
@RBrid RBrid deleted the user/regisb/UniformGridLayoutFix2 branch May 12, 2021 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ItemsRepeater team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants