Skip to content

Fix tabbed layout tab ordering - #54

Merged
emosaru merged 1 commit into
avaloniafrom
claude/eloquent-almeida
Apr 16, 2026
Merged

Fix tabbed layout tab ordering#54
emosaru merged 1 commit into
avaloniafrom
claude/eloquent-almeida

Conversation

@emosaru

@emosaru emosaru commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Tabs in tabbed layout elements were displaying in an order other than their JSON definition order
  • The root cause: TabControl.Template was set via a Style Selector="TabControl" inside TabControl.Styles — a style setter, which has lower property-value priority than a local value and is evaluated after the Fluent theme's ControlTheme has already been applied
  • This created a window where the Fluent theme template could render tabs in its own order before the style-setter override took effect
  • Same issue applied to ItemsPanel being set via a separate Style Selector="TabControl ItemsPresenter" setter

Changes

  • Set TabControl.Template as a direct property (local value, highest priority, applied before visual tree attachment) instead of via a style override
  • Inlined ItemsPresenter.ItemsPanel directly in the template, removing the second style-timing dependency
  • TabItem visual styles remain in TabControl.Styles (no ordering implications)

Test plan

  • Load a pack with a tabbed layout element containing 3+ tabs
  • Verify tabs appear in the same left-to-right order as defined in the pack's JSON layout file

🤖 Generated with Claude Code

…of style override

Style setters (Style Selector="TabControl") have lower property-value priority
than local values and are evaluated after the Fluent theme ControlTheme has
already been applied, creating a window where the theme template can render
tabs in its own order. Setting TabControl.Template directly as a local value
ensures the custom template is in effect before the visual tree is attached,
guaranteeing tabs render in their JSON definition order.

Also inlines ItemsPresenter.ItemsPanel directly in the template rather than
via a separate Style Selector="TabControl ItemsPresenter" setter, removing
another style-timing dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@emosaru
emosaru requested a review from a team April 16, 2026 08:24
@emosaru
emosaru merged commit 8c40a58 into avalonia Apr 16, 2026
3 checks passed
@emosaru
emosaru deleted the claude/eloquent-almeida branch April 16, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant