add spacing to uniform grid - issue 8406 #17993
Open
+193
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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