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

AdaptiveGridView fix when HorizontalAlignment is not stretch #1787

Conversation

skendrot
Copy link
Contributor

@skendrot skendrot commented Feb 6, 2018

Issue: #1737

PR Type

What kind of change does this PR introduce?

[x] Bugfix

What is the current behavior?

Application will crash when HorizontalAlignment is set to anything but stretch

PR Checklist

Please check if your PR fulfills the following requirements:

What is the new behavior?

Do not subtract one from the new width. This causes the SizeChanged event to endlessly fire when the HorizontalAlignment is not Stretch because the width is continually shrinking.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Related to and caused by #1552

…event to endlessly fire when the HorizontalAlignment is Center because the width is continually shrinking.
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Tiny issue with scrollbar padding now.

@@ -233,7 +233,7 @@ private void RecalculateLayout(double containerWidth)
if (containerWidth > 0)
{
var newWidth = CalculateItemWidth(containerWidth);
ItemWidth = Math.Floor(newWidth - 1);
ItemWidth = Math.Floor(newWidth);
Copy link
Member

Choose a reason for hiding this comment

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

Was this trying to prevent overlap or something? Do we need to adjust the left value of the next item?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nmetulev Any reason you had the -1 in there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't do any layout with this control. We just set the height and width of the GridViewItem controls through binding to ItemHeight and ItemWidth

@@ -233,7 +233,7 @@ private void RecalculateLayout(double containerWidth)
if (containerWidth > 0)
{
var newWidth = CalculateItemWidth(containerWidth);
ItemWidth = Math.Floor(newWidth - 1);
ItemWidth = Math.Floor(newWidth);
Copy link
Member

Choose a reason for hiding this comment

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

Another issue with scrollbars. Before:
image

After, the collapsible scrollbar is less noticeable as its margin isn't clear:
image

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's standard for lists in which the items span the entire width. Here's a standard GridView with similar settings
image

Copy link
Member

Choose a reason for hiding this comment

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

Good to know, I hadn't been paying as much attention to the overlap until this set of changes. :)

@skendrot skendrot merged commit 145abff into CommunityToolkit:master Feb 7, 2018
@windowstoolkitbot
Copy link

This PR is linked to unclosed issues. Please check if one of these issues should be closed: #1737

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants