Skip to content
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

Avoid hardcoded font properties #14088

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@
<StaticResource x:Key="CalendarViewNavigationButtonBorderBrushPointerOver"
ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="CalendarViewNavigationButtonBorderBrush" ResourceKey="SystemControlTransparentBrush" />
<x:Double x:Key="CalendarFontSize">20</x:Double>
<x:Double x:Key="CalendarDayButtonFontSize">12</x:Double>
<FontWeight x:Key="CalendarViewTodayFontWeight">SemiBold</FontWeight>

<!-- Resources for Expander.xaml -->
<!-- Expander:Header -->
Expand Down Expand Up @@ -1180,6 +1183,9 @@
<StaticResource x:Key="CalendarViewNavigationButtonBorderBrushPointerOver"
ResourceKey="SystemControlHighlightTransparentBrush" />
<StaticResource x:Key="CalendarViewNavigationButtonBorderBrush" ResourceKey="SystemControlTransparentBrush" />
<x:Double x:Key="CalendarFontSize">20</x:Double>
<x:Double x:Key="CalendarDayButtonFontSize">12</x:Double>
<FontWeight x:Key="CalendarViewTodayFontWeight">SemiBold</FontWeight>

<!-- Resources for Expander.xaml -->
<!-- Expander:Header -->
Expand Down
4 changes: 0 additions & 4 deletions src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
<Setter Property="MaxDropDownHeight" Value="{DynamicResource AutoCompleteListMaxHeight}" />
<Setter Property="Template">
Expand All @@ -43,9 +42,6 @@
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
CaretIndex="{TemplateBinding CaretIndex, Mode=TwoWay}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
Padding="{TemplateBinding Padding}"
Margin="0"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" />
Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Focusable" Value="True"/>
Expand All @@ -104,7 +103,6 @@
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
Foreground="{TemplateBinding Foreground}"
FontSize="{TemplateBinding FontSize}"
MinWidth="34">
<PathIcon Width="16"
Height="8"
Expand All @@ -119,7 +117,6 @@
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
Foreground="{TemplateBinding Foreground}"
FontSize="{TemplateBinding FontSize}"
MinWidth="34">
<PathIcon Width="16"
Height="8"
Expand Down
1 change: 1 addition & 0 deletions src/Avalonia.Themes.Fluent/Controls/Calendar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource CalendarFontSize}" />
<Setter Property="Template">
<ControlTemplate>
<StackPanel
Expand Down
4 changes: 1 addition & 3 deletions src/Avalonia.Themes.Fluent/Controls/CalendarButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<Setter Property="Background" Value="{DynamicResource CalendarViewCalendarItemRevealBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalendarViewCalendarItemRevealBorderBrush}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="FontSize" Value="20" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
Expand All @@ -41,7 +40,6 @@
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="{TemplateBinding FontSize}"
Margin="{TemplateBinding Padding}" />
</Border>

Expand Down Expand Up @@ -73,7 +71,7 @@

<Style Selector="^ /template/ ContentPresenter#Content">
<Setter Property="Foreground" Value="{DynamicResource CalendarViewTodayForeground}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontWeight" Value="{DynamicResource CalendarViewTodayFontWeight}" />
</Style>

<Style Selector="^:pointerover">
Expand Down
2 changes: 0 additions & 2 deletions src/Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<Setter Property="Background" Value="{DynamicResource CalendarViewCalendarItemRevealBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalendarViewCalendarItemRevealBorderBrush}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="FontSize" Value="20" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
Expand All @@ -42,7 +41,6 @@
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="{TemplateBinding FontSize}"
Margin="{TemplateBinding Padding}" />

</Border>
Expand Down
3 changes: 1 addition & 2 deletions src/Avalonia.Themes.Fluent/Controls/CalendarItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="{DynamicResource CalendarViewNavigationButtonBackground}" />
<Setter Property="Template">
<ControlTemplate>
Expand Down Expand Up @@ -61,7 +60,7 @@
<TextBlock Text="{Binding}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12" />
FontSize="{DynamicResource CalendarDayButtonFontSize}" />
</Template>
</Setter>

Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="MinHeight" Value="32" />
<Setter Property="Foreground" Value="{DynamicResource CheckBoxForegroundUnchecked}" />
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource ComboBoxPlaceHolderForeground}" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
2 changes: 0 additions & 2 deletions src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
<Setter Property="MinHeight" Value="{DynamicResource MenuFlyoutThemeMinHeight}" />
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutPresenterThemePadding}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="TextBlock.FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="TextBlock.FontWeight" Value="Normal" />
<Setter Property="WindowManagerAddShadowHint" Value="False" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
18 changes: 3 additions & 15 deletions src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
</ControlTheme>

<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker">
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrush}"/>
Expand All @@ -99,20 +98,11 @@
TemplatedControl.IsTemplateFocusTarget="True">
<Grid Name="PART_ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock Name="PART_DayTextBlock" Text="day" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
Padding="{DynamicResource DatePickerHostPadding}"/>
<TextBlock Name="PART_MonthTextBlock" Text="month" TextAlignment="Left"
Padding="{DynamicResource DatePickerHostMonthPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
Padding="{DynamicResource DatePickerHostMonthPadding}"/>
<TextBlock Name="PART_YearTextBlock" Text="year" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
Padding="{DynamicResource DatePickerHostPadding}"/>
<Rectangle x:Name="PART_FirstSpacer"
Fill="{DynamicResource DatePickerSpacerFill}"
HorizontalAlignment="Center"
Expand Down Expand Up @@ -156,8 +146,6 @@
<Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" />
<Setter Property="MaxHeight" Value="398" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Background" Value="{DynamicResource DatePickerFlyoutPresenterBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerFlyoutPresenterBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource DateTimeFlyoutBorderThickness}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,13 @@
ContentTemplate="{TemplateBinding HeaderTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
FontFamily="{TemplateBinding FontFamily}"
FontStyle="{TemplateBinding FontStyle}"
Grid.Row="0" />
<ContentPresenter Name="PART_ContentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
RecognizesAccessKey="True"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
FontFamily="{TemplateBinding FontFamily}"
FontStyle="{TemplateBinding FontStyle}"
Grid.Row="1" />
</Grid>
</Border>
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/ListBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="ScrollViewer.IsScrollInertiaEnabled" Value="True" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="border"
Expand Down
5 changes: 0 additions & 5 deletions src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
</Border>
</Design.PreviewWith>
<Thickness x:Key="ListBoxItemPadding">12,9,12,12</Thickness>
<FontWeight x:Key="ListBoxItemFontWeight">Normal</FontWeight>
<ControlTheme x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="{DynamicResource ListBoxItemPadding}" />
<Setter Property="FontWeight" Value="{DynamicResource ListBoxItemFontWeight}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter"
Expand All @@ -29,8 +26,6 @@
CornerRadius="{TemplateBinding CornerRadius}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/Menu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<Setter Property="Background" Value="{DynamicResource MenuFlyoutItemBackground}" />
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForeground}" />
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Padding" Value="{DynamicResource MenuBarItemPadding}" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForeground}" />
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutItemThemePaddingNarrow}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<ControlTemplate>
<Panel>
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/NotificationCard.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<ControlTheme x:Key="{x:Type NotificationCard}" TargetType="NotificationCard">
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="Width" Value="350"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="{DynamicResource NotificationCardForegroundBrush}"/>
<Setter Property="RenderTransformOrigin" Value="50%,75%"/>
<Setter Property="BorderThickness" Value="0" />
Expand Down
2 changes: 0 additions & 2 deletions src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Template">
Expand All @@ -51,7 +50,6 @@
Padding="{TemplateBinding Padding}"
MinWidth="0"
Foreground="{TemplateBinding Foreground}"
FontSize="{TemplateBinding FontSize}"
Watermark="{TemplateBinding Watermark}"
IsReadOnly="{TemplateBinding IsReadOnly}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}"/>
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="400" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="400" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontStyle" Value="Normal" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/RadioButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<ControlTemplate TargetType="RadioButton">
<Border
Expand Down
2 changes: 0 additions & 2 deletions src/Avalonia.Themes.Fluent/Controls/RepeatButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="RenderTransform" Value="none" />
<Setter Property="Template">
<ControlTemplate>
Expand Down
1 change: 0 additions & 1 deletion src/Avalonia.Themes.Fluent/Controls/Slider.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
<Setter Property="Background" Value="{DynamicResource SliderTrackFill}" />
<Setter Property="BorderThickness" Value="{DynamicResource SliderBorderThemeThickness}" />
<Setter Property="Foreground" Value="{DynamicResource SliderTrackValueFill}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Style Selector="^:horizontal">
<Setter Property="Template">
<ControlTemplate>
Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.Themes.Fluent/Controls/SplitButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@
Command="{TemplateBinding Command}"
CommandParameter="{TemplateBinding CommandParameter}"
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource LeftCornerRadiusFilterConverter}}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Expand Down
Loading