-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Staggered panel #1713
Staggered panel #1713
Conversation
Thoughts on making this orientation aware with an Orientation property, so it can optionally stack in rows instead of columns? Doesn't seem like it'd take much to do it |
I did think about that, but decided against because the use-cases I came up with order mattered. Meaning that items would need to be in a particular row, rather than a random row. Do you have a good use-case for changing orientation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good other than the resize bug
private int GetColumnIndex(double[] columnHeights) | ||
{ | ||
int columnIndex = 0; | ||
double height = columnHeights[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works beautifully 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately couldn't find something major :(
|
||
private void OnHorizontalAlignmentChanged(DependencyObject sender, DependencyProperty dp) | ||
{ | ||
InvalidateMeasure(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to InvalidateArrange to restart the whole process and InvalidateArrange will call InvalidateMeasure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling InvalidateArrange will only call into ArrangeOverride and not MeasureOverride. When these change we need to remeasure for layout. We probably could only call InvalideArrange if the HorizontalAlignment was not going to/from Stretch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, this would force us to keep the previous state as we don't know what the old value was when using RegisterPropertyChangedCallback
{ | ||
if (d is StaggeredPanel panel) | ||
{ | ||
panel.InvalidateMeasure(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing for invalidateArrange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling InvalidateArrange will only call into ArrangeOverride and not MeasureOverride. When this value changes we need to remeasure for layout.
|
||
private static void OnDesiredColumnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
if (d is StaggeredPanel panel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can cast directly as this property will not be used anywhere else
@nmetulev can you re-review? I added the Padding property to the panel |
This PR is linked to unclosed issues. Please check if one of these issues should be closed: #21 |
Issue: #21
PR Type
What kind of change does this PR introduce?
PR Checklist
Please check if your PR fulfills the following requirements:
What is the new behavior?
New panel control for displaying content in a staggered approach.
Does this PR introduce a breaking change?
Other information