-
Notifications
You must be signed in to change notification settings - Fork 337
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
Scale widget size with system Text Size #2723
Conversation
tools/Dashboard/DevHome.Dashboard/Controls/WidgetControl.xaml.cs
Outdated
Show resolved
Hide resolved
private SelectableMenuFlyoutItem _currentSelectedSize; | ||
|
||
[ObservableProperty] | ||
private GridLength _headerHeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, these attributes should only be in ViewModels because the view should have no logic besides showing the view.
However, these members control the view and make the view simpler to understand.
I don't know when too much spillover of [ObservableProperty]
into the view is too much.
But. I'm not blocking on this. Just a though.
WidgetHeight = GetPixelHeightFromWidgetSize(WidgetSource.WidgetSize) * textScale; | ||
WidgetWidth = WidgetHelpers.WidgetPxWidth * textScale; | ||
} | ||
|
||
private async void OpenWidgetMenuAsync(object sender, RoutedEventArgs e) | ||
{ | ||
if (sender as Button is Button widgetMenuButton) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender as button widgetMenuButton
would work here, ya?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this way protects against the null case. And if (sender as Button widgetMenuButton)
doesn't work because it doesn't evaluate to a boolean.
Summary of the pull request
There are a few accessibility bugs around text being cut off inside widgets when system text scaling is turned up (Windows Settings > Accessibility > Text size). The Windows Widget Board (
🪟+w
) scales up the entire widget to match the text scaling, so we will, too. For example, the normal widget width is 300 pixels. If text scaling is at 200%, our widgets will become 600 px wide. Height also scales.References and relevant issues
https://task.ms/49360547
https://task.ms/49658528
Detailed description of the pull request / Additional comments
GetPixelHeightFromWidgetSize
moves to WidgetControl since that is the only place it is used.Validation steps performed
PR checklist