-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
#3070 Stretch the content of the expander header #3096
Conversation
Thanks for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
Thanks @skendrot. It'll be a breaking change if their content is aligned differently, eh? Trying to think if there'd be an easy way to expose these bound from the Expander itself somehow, so it's more configurable, then we could at least leave the default the same... |
@skendrot think you missed my question. Could we somehow TemplateBind this property to the Expander's HorizontalContentAlignment property so we could keep the default, but make this an option and not have it be a breaking change? |
@skendrot thoughts on removing the line in the Style all together as the default for HorizontalContentAlignment should be <ToggleButton x:Name="PART_ExpanderToggleButton"
MinWidth="40"
MinHeight="40"
AutomationProperties.Name="Expand"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{TemplateBinding HeaderStyle}"
TabIndex="0" /> This should allow a developer to just do: <controls:Expander HorizontalContentAlignment="Stretch"> ... |
@michael-hawker Should the ToggleButton bind to the HorizontalContentAlignment? Or HorizontalAlignment. The ToggleButton isn't considered to be the Content of the control. Maybe instead Change to bind to the HorizontalAlignment? |
Thinking about it more. Maybe it does makes sense for the content of the toggle button to align with the HorizontalContentAlignment of the expander itself. |
@michael-hawker what more is needed here? |
@skendrot sorry I meant to get to this the other day, but I've had to reset both my machines this week and slowed me down. I discussed with some others on my team about this problem, the consensus was that we should just introduce a new property to deal with this If you'd like to add the new property, let me know. |
Why would we need a new property? I say it's a breaking change, but in reality it's probably not going to affect anyone |
@skendrot there's cases I've used an Expander with a Grid to size/place icons next to stuff where this would break it, so we wanted to be cautious. Also the |
@michael-hawker I don't see a need for a property for just aligning the header content. That's easily achievable with a quick style.
|
Going to move this out for now, we can try and better address with more concrete template changes in 7.0 |
Saw this same bug was carried over to the new WinUI version in the works so filed an issue there: microsoft/microsoft-ui-xaml#4248 For now let's just merge this change in and make a doc note, and we can figure out an alternative later if needed or we'll be deprecating this control soon in favor of the WinUI one. |
@RosarioPulella mind just cherry-picking this commit on top of main so @skendrot can get credit and we'll just have a cleaner history rather than trying to resolve the merge based on this older branch? Thanks! |
Done in #3769 from cherry-picked commit. Closing this one. |
Fixes #3070
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The Expander Header is left aligned
What is the new behavior?
The expander header will stretch to fit it's space. BREAKING CHANGE
PR Checklist
Please check if your PR fulfills the following requirements:
This is a breaking *style change. Content that was left aligned will now stretch. This could change how an application looks
Other information