-
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] Style improvements #210
Conversation
Nice to see these changes! My only concern here is for apps that want to ensure the same uniform look on all platforms. In that case they may want to use the override styles on all platforms including windows (I would probably use that as the default myself). In that case I wonder if the option shouldn't be renamed to something more specific like |
They were kept in for compatibility to not break existing apps so much with the changes for Fluent v2. |
I had a similar thought, just thinking of the best approach. I like the enum idea though, might be what I end up doing. I need to think on the property name some though |
Some updates to the styles here, including a big one that should help on non-Windows platforms:
On account of #128 & #209, I'm adding a way to help adjust text positioning in some controls when not on Windows. Right now we have a problem that Fluent design is primarily targeted at Windows where Segoe UI or Segoe UI Variable font families are available, leading to some controls having text positioned wrong on Mac/Linux where the fonts aren't available. This is done because fluent design says the first line of text should be level with the control (accounting for multi-line scenarios) so vertical alignment is set to top and margins/paddings are used to position the text - based on Segoe UI. The worst offenders of this were
CheckBox
,RadioButton
, andComboBox
.To try and fix this,
I've added a property to FluentAvaloniaThemeIf set, and not on Windows, some styling overrides are injected to use vertical alignment and adjust some of the uneven margins to make things look a little better. These overrides are added internally inside FATheme, so you can still override further if needed. This isn't a perfect solutionUseStyleOverridesForNonWindows
, which defaults to true.because this may lead to different appearances in Windows vs other platforms (primarily if multi-line text is needed),but this is as much as I can do on my end at this point and I think its a fair solutionI've only addressed the 3 controls above. The rest by my eye look the same on Windows or aren't affected.
[WSL2 ubuntu linux]
Before:
After:
[Other]
CheckBox
to useDynamicResource
instead ofStaticResource
ListBoxItem
to match WinUI (left margin increased from 12 to 16)fixes #209
fixes #128
Edit:
I've changed the API a little. Instead of a bool and only applying on non-Windows, it's now an enum based on @robloo's suggestion below, and the property is now called
TextVerticalAlignmentOverrideBehavior
. The default value isEnabledNonWindows
.