Skip to content

fix(controls): Support ExpandDirection and clicking anywhere on header to expand (Expander.xaml)#1664

Open
Alex4SSB wants to merge 8 commits intolepoco:mainfrom
Alex4SSB:main
Open

fix(controls): Support ExpandDirection and clicking anywhere on header to expand (Expander.xaml)#1664
Alex4SSB wants to merge 8 commits intolepoco:mainfrom
Alex4SSB:main

Conversation

@Alex4SSB
Copy link
Contributor

@Alex4SSB Alex4SSB commented Mar 2, 2026

WPF expander has a built-in property for ExpandDirection, which sometimes can be useful. Also, clicking in the bottom/top 1/4 of the expander header's height doesn't expand it.
Also, there was a TODO in the gallery Expander page - that's dealt with now, at least for the regular Expander, not for the CardExpander.

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

  1. There is no support for the built-in Expander property ExpandDirection.
  2. Only the actual height occupied by the header ToggleButton content (ex.: text) is clickable to affect IsExpanded state.
    Issue Number: N/A

What is the new behavior?

The Expander now fully supports ExpandDirection:

  • ToggleButton and ContentPresenter are docked accordingly
  • BorderThickness and CornerRadius are adjusted accordingly
  • RenderTransform direction is adjusted accordingly
  • Clicking anywhere on the header will now affect IsExpanded state

Notes

Currently in the gallery app, Down (default), Left and Right directions work correctly, but Up lacks correct animation, until cycled through Left / Right first. Shouldn't a problem for most library users though, as an Expander rarely has its direction changed at run-time like in the gallery.

Alex4SSB and others added 4 commits December 20, 2025 17:03
Setting HorizontalAlignment=Right when FlowDirection is RightToLeft achieves the exact opposite of the desired if the RadioButton's parent is also set to RightToLeft. This apparently also prevents any derived styles (and even direct control properties) from changing this behavior.
• ToggleButton and ContentPresenter are docked accordingly
• BorderThickness and CornerRadius are adjusted accordingly
• RenderTransform direction is adjusted accordingly
@Alex4SSB Alex4SSB requested a review from pomianowski as a code owner March 2, 2026 18:39
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request release labels Mar 2, 2026
@github-actions github-actions bot added gallery WPF UI Gallery dotnet labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controls Changes to the appearance or logic of custom controls. dotnet gallery WPF UI Gallery PR Pull request release styles Topic is related to styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants