-
Notifications
You must be signed in to change notification settings - Fork 106
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
[v2] New Control - SettingsExpander #211
Conversation
Just a suggestion. I think the |
Ok, well done. I just write without checking the code, a bad habit. |
Yes. This is being built to support binding/data templates. Of course the original Windows design as far as I can tell is meant for strings, but why not give more control if you desire it. On |
Should I would help with any implementation and can update control templates. |
I'm sure it would be helpful to someone, however, I don't want to be the one to do it. |
Technically not entirely new as this existed in my Sample app albeit with a different name, but I'm revamping it before I start the upcoming facelift to the sample app and moving it to the main controls library as it may be useful to others.
Introducing the
SettingsExpander
control (which can be seen in the Windows 11 settings app, for example). Some inspirations for the new design come from here, though its not entirely the same.In addition, I've also added a new control
FABorder
. Part of the design of theSettingsExpander
requires the background of a Border to be on the inner edge of the border. Avalonia's border rendering is to place the background in the middle of the stroke - assuming uniform corner radius. This is very noticeable with the translucent stroke colors in Fluent v2. So, I've ported theBackgroundSizing
property from UWP toFABorder
to help this situation. Note that whileFABorder
inherits fromBorder
, the pen properties that were recently added (dash style, etc) are not and will not be supported.As this is still a WIP, I'll have more on the API design later.I can say though, thatSettingsExpander
is anItemsControl
and is being built to work with binding items - so it's not a Xaml/Code only control.API & design:
Adaptive Width Trigger:
When a
SettingsExpander
orSettingExpanderItem
gets too small, the footer content will be moved below the header/content & description and left-aligned to ensure content is displayed nicely. The default width is 460, smaller will trigger this state to occur. This is customizable by overriding the resourceSettingsExpanderItemAdaptiveWidthTrigger
IsClickEnabled
Noted above in the comment for
IsClickEnabled
, you cannot set child items andIsClickEnabled
totrue
. Doing so will throw and exception.ActionIconSource property
When
IsClickEnabled
istrue
, you can specify theActionIconSource
to provide an icon on the right side of the control (in LTR) to indicate clicking will do some sort of action. There is no default icon provided here. If you want a chevron, use aSymbolIconSource
withSymbol=ChevronRight
. If you want the icon like in the screenshot above (the last child item under AccentColor), use aFontIconSource
with the FontFamily set toSymbolThemeFontFamily
and glyph
TODO:
- [x] Expand/Collapse animationEdit:
I've decided NOT to add the expand/collapse animation to the SettingsExpander, in my testing it just didn't look that great. You can still set the
ContentTransition
property on the innerExpander
through a custom style selector, however.