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

Adding SelectionMode to TabStrip #18109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nickodei
Copy link
Contributor

@nickodei nickodei commented Feb 3, 2025

What does the pull request do?

This implements #17969. In essence, it exposes the SelectionMode property to make the selection mode configurable and it disables the behavior that the first item is always selected. This mimics the behavior of the ListBox.

What is the current behavior?

First item is always selected and you can't change the SelectionMode.

What is the updated/expected behavior with this PR?

I updated the ControlCatalog to allow to "play" with the settings:

image

Checklist

Fixed issues

Implements #17969

@nickodei nickodei marked this pull request as draft February 3, 2025 15:57
@nickodei
Copy link
Contributor Author

nickodei commented Feb 3, 2025

Should I add the same key behaviors as the ListBox? (e.g. Moving with Navigation-Keys or Control to select specific items)

@nickodei nickodei marked this pull request as ready for review February 12, 2025 16:31
@emmauss emmauss requested review from grokys and maxkatz6 and removed request for grokys February 12, 2025 16:46
@avaloniaui-bot
Copy link

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

Comment on lines +31 to +32
Assert.Equal(-1, target.SelectedIndex);
Assert.Same(null, target.SelectedItem);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we can't change default behavior.
TabStrip.SelectionMode default should be changed to match old behavior, even if it's different from ListBox.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely, you only need to revert SelectionModeProperty.OverrideDefaultValue<TabStrip>(SelectionMode.AlwaysSelected); line.

@MrJul MrJul added the feature label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants