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

Added WrapPanel item alignment #17792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomEdwardsEnscape
Copy link
Contributor

Adds WrapPanel.ItemAlignment, which allows wrapped items to be left/top, centre, or right/bottom aligned.

image

The property is an enum type with the values are Start, Center, and End. These names encompass both horizontal and vertical orientations.

What is the current behavior?

Items are always laid out starting from the left/top of a WrapPanel. There is no way to configure this.

Breaking changes

None.

Obsoletions / Deprecations

None.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0054001-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@robloo
Copy link
Contributor

robloo commented Dec 17, 2024

I think we should debate the API here. It doesn't really match with HorizontalAlignment, HorizontalContentAlignment or TextAlignment.

@TomEdwardsEnscape
Copy link
Contributor Author

This is because the panel can also be oriented vertically too. A unified alignment property like the one in this PR is also used by the CSS flex-box.

@timunie
Copy link
Contributor

timunie commented Dec 17, 2024

Yeah the names are okay to me. However I would like to align the new enums, given the team accept this PR, with Avalonia.Labs VirtualizingWrapPanel, which I have a draft PR open.

In addition to start, end and center, should we add Stretch? Also uniform distribution may be nice. Not sure if the later needs to be part of this PR.

@stevemonaco
Copy link
Contributor

Keep in mind that FlexPanel exists in Avalonia.Labs which has a lot of overlapping functionality. See screenshot:

image

Some decision probably needs to be made regarding whether WrapPanel is a layout control specifically intended for WPF ports, possibly with spacing added to match WCT's UWP/WinUI3 implementation, or whether it starts to march towards a flex box.

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

Successfully merging this pull request may close these issues.

5 participants