-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Add RowSpacing and ColumnSpacing #18077
base: master
Are you sure you want to change the base?
Conversation
You can test this PR using the following package version. |
|
@cla-avalonia agree |
/// Defines the <see cref="ColumnSpacing"/> property. | ||
/// </summary> | ||
public static readonly StyledProperty<double> ColumnSpacingProperty = | ||
AvaloniaProperty.Register<Grid, double>(nameof(ColumnSpacingProperty)); |
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.
Would it make sense to add coercion for negative values? Or does UWP support them?
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.
negative spacing is not recommended feature, but it is supported in uwp/winui3. And so do this PR. This PR support negative spacing, too.
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 also think we should support negative Spacing if possible. It matches with what is allowed for Margin/Padding which can be negative.
There are some rare layout cases it's useful and by default the math usually supports negatives for free.
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.
Now both the spacing in uwp/winui3 and in these 3 PRs don't support negative values in principle, but in practice they do support (
Great work! This has been a nice to have for a long time. |
I'm marking this PR with |
It also matches UWP/WinUI as-is and I've never heard of concerns with that API. |
What does the pull request do?
Add

RowSpacing
andColumnSpacing
properties forGrid
, just like in UWP and WinUI 3.What is the updated/expected behavior with this PR?
Grid
with various children.RowSpacing
andColumnSpacing
to non-zero values.How was the solution implemented (if it's not obvious)?
Add the corresponding spacing before calculating the position of each
RowDefinition
orColumnDefinition
.Subtract spacing before calculating stars when
GridUnitType=star
.Checklist
Breaking changes
None
Obsoletions / Deprecations
None
Fixed issues
Fixes #5152