Fix some issues on SelectingItemsControls when items or control changes visibility#20798
Fix some issues on SelectingItemsControls when items or control changes visibility#20798timunie wants to merge 12 commits intoAvaloniaUI:masterfrom
Conversation
|
You can test this PR using the following package version. |
when nothing was selected beforehand and AlwaysSelected is true
The TabItem now handles the correct selection of only visible items
429ebbb to
b28138e
Compare
Otherwise API-diff will fail.
|
You can test this PR using the following package version. |
robloo
left a comment
There was a problem hiding this comment.
I left some comments on the code changes but overall looks really good. I will have to find the time to test this later though. I've only looked at the code.
| /// Finds the first visible and enabled index in the ItemsSource. | ||
| /// </summary> | ||
| /// <returns>the index of the first visible and enabled item, or -1 if none found</returns> | ||
| private int GetFirstVisibleAndEnabledIndex() |
There was a problem hiding this comment.
I'll place general comments here. Without testing, my understanding of WPF is:
- Enabled=false tabs are still visible but can't be clicked. If there are NO other tabs the Enabled=False tab should be the one visible but with all it's content disabled.
- Visible=false tabs are completely hidden and removed from the control
Part 1 likely doesn't function the same since you are treating Enabled/Visible as equivalent -- they have slight differences.
Visible=false
- Never visible in the tab strip, so can't be selected by the user
- Never visible in the tab content (this is the needed fix)
Enabled=false
- Always visible in the tab strip.... but with the disabled styling. Cannot be selected by the user, but can be selected as the default.
- MAY BE visible in the tab content if there are NO other tab pages
There was a problem hiding this comment.
These tabs can be selected programatically. I am not sure how to deal with that if really all tabs are either disabled or hidden. We should review this in the team before making an decision.
|
You can test this PR using the following package version. |
What does the pull request do?
What is the current behavior?
SelectingItemsControls with AlwaysSelected set can select invisible items by accident
What is the updated/expected behavior with this PR?
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
ColorView API was changed by removing not needed protected void
Obsoletions / Deprecations
Fixed issues
Fixes #14718
Fixes #13736 (@robloo this should be the last issue to solve, so I'll close the rollup with this PR)