-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
add spacing to uniform grid - issue 8406 #17993
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
add spacing to uniform grid - issue 8406 #17993
Conversation
You can test this PR using the following package version. |
|
@cla-avalonia agree |
Diff for API review: namespace Avalonia.Controls.Primitives
{
public class UniformGrid
{
+ public static readonly StyledProperty<double> RowSpacingProperty;
+ public static readonly StyledProperty<double> ColumnSpacingProperty;
+ public double RowSpacing { get; set; }
+ public double ColumnSpacing { get; set; }
}
} |
You can test this PR using the following package version. |
Notes from the API review: We're happy with the proposed API, which matches WinUI. |
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.
A couple of changes are needed and this PR will be good to merge.
The unit tests are really appreciated!
… spacing properties
…m/Enzx/Avalonia into add-uniformgrid-spacing-issue8406
You can test this PR using the following package version. |
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.
LGTM, thank you!
What does the pull request do?
This pull request addresses this Issue:
#8406 (Marked as Enhancement)
This pull request adds
RowSpacing
andColumnSpacing
properties to theUniformGrid
control in Avalonia. These properties allow developers to define the spacing between rows and columns, making creating consistent and flexible layouts easier. This update addresses limitations in the currentUniformGrid
implementation, such as the lack of built-in support for spacing, which previously required cumbersome workarounds.What is the current behavior?
Currently,
UniformGrid
does not support row or column spacing. Developers often use workarounds such as:Grid
.Margin
values for individual children.These methods are error-prone, hard to maintain, and do not scale well for larger layouts.
What is the updated/expected behavior with this PR?
With this PR, developers can set the
RowSpacing
andColumnSpacing
properties directly onUniformGrid
. The grid will automatically apply the specified spacing while maintaining uniform child sizes and alignment.How to test the PR:
UniformGrid
with various children.RowSpacing
andColumnSpacing
to non-zero values.How was the solution implemented (if it's not obvious)?
RowSpacing
andColumnSpacing
as styled properties with a default value of0
.Checklist
Breaking changes
None. The default values for
RowSpacing
andColumnSpacing
are0
, preserving existing behavior for layouts that do not use these properties.Obsoletions / Deprecations
None.
Fixed issues
#8406