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

WrapPanel inside Listbox (ItemsPanelTemplate) only work/wrap with FluentTheme. #15788

Closed
H97-Git opened this issue May 22, 2024 · 5 comments
Closed
Labels

Comments

@H97-Git
Copy link

H97-Git commented May 22, 2024

Describe the bug

  1. WrapPanel inside a ListBox doesn't wrap.
  2. If used with anything else than FluentTheme.

2024_05_22_16-59__wPl
2024_05_22_17-00__G7T

To Reproduce

Quick repo to reproduce

Avalonia.Sandbox

Expected behavior

WrapPanel should wrap regardless of the theme used.

Avalonia version

11.0.10

OS

Windows

Additional context

I was testing ActiPro theme/Controls inside my app and using the theme broke the layout for my file explorer.
At first I thought it was an ActiPro issue but with further testing I saw that WrapPanel inside ListBox only wrap with FluentTheme.

Maybe I did something wrong and this is not a bug but I will rather ask.

@H97-Git H97-Git added the bug label May 22, 2024
@MrJul
Copy link
Member

MrJul commented May 22, 2024

It isn't really related to WrapPanel itself.

The HorizontalScrollBarVisibility for ListBox is set to Auto in the Simple theme:

<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />

This gives the control infinite horizontal space, so as far as the WrapPanel is concerned, there's enough space and nothing is wrapped. The default is Disabled, which is what the Fluent theme uses.

Add ScrollViewer.HorizontalScrollBarVisibility="Disabled" to your ListBox and it'll work with all themes.

That being said, I'm leaving this issue open, as I'm not sure sure why the Simple theme uses Auto here. Git blame says that it was Auto for both themes in the past, then Fluent was changed to Disabled, but Simple hasn't been touched.

I suggest we change the default to Disabled for the Simple theme too.

@H97-Git
Copy link
Author

H97-Git commented May 22, 2024

Oh! I see, that does make sense. 😄

I'm not sure how to:

Add ScrollViewer.HorizontalScrollBarVisibility="Disabled" to your ListBox and it'll work with all themes.

But following #12029, I did:
ScrollViewer.SetHorizontalScrollBarVisibility(SandBoxListBox,ScrollBarVisibility.Disabled);

And it solved my issue. ❤️
Thank you!

@MrJul
Copy link
Member

MrJul commented May 22, 2024

I'm not sure how to:

Add ScrollViewer.HorizontalScrollBarVisibility="Disabled" to your ListBox and it'll work with all themes.

As typed :) It's an attached property, like Grid.Row:
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" ...>

@maxkatz6
Copy link
Member

Closing as by design. With options to redefine behavior.

@maxkatz6 maxkatz6 closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
@timunie
Copy link
Contributor

timunie commented May 23, 2024

@maxkatz6 do you think simple theme should be changed to follow FluentTheme here or not?

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

No branches or pull requests

4 participants