Port SettingsCard/Expander from WCT and update SUI to use it#20232
Port SettingsCard/Expander from WCT and update SUI to use it#20232carlos-zamora wants to merge 9 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
|
UI changes I noticed while poking around:
I hit a point where I could go in and make everything look the same as we have it now, but I felt that that mildly contradicted the idea behind trying to make the UI "consistent" by using these controls. @niels9001 I'll go through and do a second pass fixing the things above. Can you also go through it and point out any inconsistencies with the UI that should be addressed? The main files that are probably of interest are:
Once we figure that out and this gets reviewed/merged, we can probably use |
The issue is that we are now mixing-and-matching How big is the gap between |
| const auto helpText{ HelpText() }; | ||
|
|
||
| // Forward HelpText into the SettingsCard / SettingsExpander Description | ||
| // slot so it renders through the WCT-ported PART_DescriptionPresenter. |
| Toolkit uses a muxc:AnimatedIcon wrapping AnimatedChevronUpDownSmallVisualSource. | ||
| That visual source isn't available in the WinUI 2 build the editor targets, so | ||
| we fall back to a static FontIcon and drive a RotateTransform via the | ||
| Checked*/unchecked CommonStates Storyboards (DoubleAnimation between 0° and 180°). |
This comment has been minimized.
This comment has been minimized.
| // be shared across cards) and a default string was rendering | ||
| // through ContentPresenter -> TextBlock, whose line-height | ||
| // padding made the Viewbox-scaled glyph visibly smaller than | ||
| // WCT's SymbolIcon default. |
|
|
||
| void SettingsCard::OnApplyTemplate() | ||
| { | ||
| // Match WCT's SettingsCard.OnApplyTemplate() which calls base first so the |
| // Inject the shared implicit ToggleSwitch / Slider / ComboBox / TextBox | ||
| // dictionary so child controls in our Content slot get the Windows 11 | ||
| // settings-page defaults without an explicit Style attribute. Bypasses | ||
| // the WCT Setter.Value-with-inline-ResourceDictionary pattern, which |
| // by C++ GoToState don't reliably engage. The ContentSpacing setter | ||
| // targets PART_RootGrid.RowSpacing; set it directly here as well so the | ||
| // Vertical / RightWrapped stacked-layout cards actually get the breathing | ||
| // room between header and content that WCT shows. |
| // machine in sync (so _CheckVerticalSpacingState sees the right CurrentState), | ||
| // but we *also* apply the layout properties directly to PART_ContentPresenter | ||
| // because in WinUI 2, attached-property changes (Grid.Row/Grid.Column) and | ||
| // HorizontalAlignment changes inside VisualState.Setters or Storyboards |
| layout work happens in SettingsCard::_UpdateContentAlignmentState | ||
| via direct property writes on PART_ContentPresenter — in WinUI 2, | ||
| attached-property changes ((Grid.Row)/(Grid.Column)) inside | ||
| VisualState.Setters or Storyboards don't reliably engage when |
|
|
||
| namespace Microsoft.Terminal.Settings.Editor | ||
| { | ||
| [contentproperty("Content")] |
| static Windows.UI.Xaml.ResourceDictionary GetResources(Windows.UI.Xaml.DependencyObject target); | ||
| static void SetResources(Windows.UI.Xaml.DependencyObject target, Windows.UI.Xaml.ResourceDictionary value); | ||
|
|
||
| // Idempotently merges the project's SettingsControlsImplicitStyles.xaml |
@check-spelling-bot Report
|
| Dictionary | Entries | Covers | Uniquely |
|---|---|---|---|
| cspell:csharp/csharp.txt | 32 | 2 | 2 |
| cspell:aws/aws.txt | 232 | 2 | 2 |
| cspell:fonts/fonts.txt | 536 | 1 | 1 |
Consider adding to the extra_dictionaries array (in the .github/actions/spelling/config.json file):
"cspell:csharp/csharp.txt",
"cspell:aws/aws.txt",
"cspell:fonts/fonts.txt",
To stop checking additional dictionaries, put (in the .github/actions/spelling/config.json file):
"check_extra_dictionaries": []Warnings ⚠️ (1)
See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.
| Count | |
|---|---|
| 54 |
See
✏️ Contributor please read this
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
If the listed items are:
- ... misspelled, then please correct them instead of using the command.
- ... names, please add them to
.github/actions/spelling/allow/names.txt. - ... APIs, you can add them to a file in
.github/actions/spelling/allow/. - ... just things you're using, please add them to an appropriate file in
.github/actions/spelling/expect/. - ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in
.github/actions/spelling/patterns/.
See the README.md in each directory for more information.
🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉
If the flagged items are 🤯 false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it,
try adding it to thepatterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
Summary of the Pull Request
Ports the
SettingsCardandSettingsExpanderfrom Windows Community Toolkit to the TerminalSettingsEditor project:SettingsCardandSettingsExpanderwere ported over and reuse our macros to reduce boilerplate.In order to upgrade our settings UI to use these new controls, I had the existing
SettingContaineract as a wrapper for them. This provided several benefits:SettingContaineris responsible for adding the infrastructure for the reset button, which is used in profile settings to expose inheritance.Other notable changes as a part of using the new controls:
SettingsCardValidation Steps Performed
More coming soon
PR Checklist
Related to #17000