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

ListBox SelectionMode setting using Style #15762

Closed
Zelibiba opened this issue May 19, 2024 · 4 comments
Closed

ListBox SelectionMode setting using Style #15762

Zelibiba opened this issue May 19, 2024 · 4 comments

Comments

@Zelibiba
Copy link

Describe the bug

I want to set SelectionMode in ListBox to 'Multiple'. If I do it directly in the ListBox, it works fine and I can choose multiple items.
However, if I set it using Style, the ListBox doesn't change selection behaviour.

To Reproduce

Set SelectionMode using Style. Then you won't be able to select multiple items in the ListBox while holding down ctrl key.

<ListBox>
	<ListBox.Styles>
		<Style Selector="ListBox">
			<Setter Property="SelectionMode" Value="Multiple"/>
		</Style>
	</ListBox.Styles>
	<Label>1</Label>
	<Label>2</Label>
	<Label>3</Label>
</ListBox>

Expected behavior

The behavior should be the same as when setting SelectionMode directly in the ListBox.

<ListBox SelectionMode="Multiple">
        <Label>1</Label>
	<Label>2</Label>
	<Label>3</Label>
</ListBox>

Avalonia version

11.0.0, 11.0.6, 11.0.10

OS

Windows

Additional context

This bug doesn't occur in version 0.10.22.

@Zelibiba Zelibiba added the bug label May 19, 2024
@timunie
Copy link
Contributor

timunie commented May 19, 2024

I believe the issue is that you add the style inside ListBox styles. But the ListBox will only look for patent styles. Can you try to add the style in your root element or App.Styles?

@Zelibiba
Copy link
Author

Oh, I forgot to mention that. This doesn't work with the style in root element or App.Styles either.

@timunie
Copy link
Contributor

timunie commented May 21, 2024

Can't reproduce this issue. Please file a minimal sample with the style being in App.axaml

@timunie timunie added needs-repro and removed bug labels May 21, 2024
@timunie
Copy link
Contributor

timunie commented May 21, 2024

will reopen this is there is a sample showing the issue

@timunie timunie closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants