Implement dynamic font settings for the setting window

This commit is contained in:
DB p 2025-04-24 10:18:38 +09:00
parent 3da3c599d9
commit f50f2ff27c
12 changed files with 30 additions and 22 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
using System.Windows;
using System.Windows.Media;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.Logger;
@ -113,6 +114,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
{
_settingWindowFont = value;
OnPropertyChanged();
Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
}
}
}

View file

@ -8,7 +8,6 @@
Width="530"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}"
Icon="Images\app.png"
MouseDown="window_MouseDown"

View file

@ -7,7 +7,6 @@
Width="530"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}"
Icon="Images\app.png"
ResizeMode="NoResize"

View file

@ -355,7 +355,7 @@
<system:String x:Key="logLevel">Log Level</system:String>
<system:String x:Key="LogLevelDEBUG">Debug</system:String>
<system:String x:Key="LogLevelINFO">Info</system:String>
<system:String x:Key="settingWindowFont">Setting Window Font</system:String>
<system:String x:Key="settingWindowFontTitle">Setting Window Font</system:String>
<!-- FileManager Setting Dialog -->
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>

View file

@ -4,6 +4,20 @@
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.modernwpf.com/2019">
<!-- Setting Window Font -->
<Style TargetType="ui:FontIcon">
<Setter Property="FontFamily" Value="/Resources/#Segoe Fluent Icons" />
</Style>
<Style TargetType="Control">
<Setter Property="FontFamily" Value="{DynamicResource SettingWindowFont}" />
</Style>
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource SettingWindowFont}" />
</Style>
<Style TargetType="Window">
<Setter Property="FontFamily" Value="{DynamicResource SettingWindowFont}" />
</Style>
<ContextMenu x:Key="TextBoxContextMenu">
<MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}">
<MenuItem.Icon>

View file

@ -7,6 +7,7 @@
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:TextConverter x:Key="TextConverter" />
<core:TranslationConverter x:Key="TranslationConverter" />
<FontFamily x:Key="SettingWindowFont">Segoe UI</FontFamily>
<!-- Icon for Theme Type Label -->
<Geometry x:Key="circle_half_stroke_solid">F1 M512,512z M0,0z M448,256C448,150,362,64,256,64L256,448C362,448,448,362,448,256z M0,256A256,256,0,1,1,512,256A256,256,0,1,1,0,256z</Geometry>

View file

@ -10,7 +10,6 @@
Width="550"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"

View file

@ -10,7 +10,6 @@
Width="600"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"

View file

@ -103,10 +103,8 @@
Margin="0 0 12 0"
Command="{Binding AskClearLogFolderConfirmationCommand}"
Content="{Binding LogFolderSize, Mode=OneWay}" />
<Button
Content="&#xec7a;"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="20">
<Button>
<ui:FontIcon FontSize="20" Glyph="&#xec7a;" />
<ui:FlyoutService.Flyout>
<ui:MenuFlyout>
<MenuItem Command="{Binding OpenWelcomeWindowCommand}" Header="{DynamicResource welcomewindow}">
@ -148,7 +146,7 @@
SelectedValuePath="Value" />
</cc:Card>
<cc:Card
Title="{DynamicResource settingWindowFont}"
Title="{DynamicResource settingWindowFontTitle}"
Icon="&#xf259;"
Type="Inside">
<StackPanel Orientation="Horizontal">

View file

@ -58,9 +58,9 @@
Margin="0 0 20 0"
Command="{Binding OpenHelperCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}}"
Content="&#xe9ce;"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
FontSize="14" />
FontSize="14">
<ui:FontIcon FontSize="14" Glyph="&#xe9ce;" />
</Button>
<TextBox
Name="PluginFilterTextbox"
Width="150"

View file

@ -13,7 +13,6 @@
MinHeight="600"
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"
Closed="OnClosed"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Icon="Images\app.ico"
Left="{Binding SettingWindowLeft, Mode=TwoWay}"
Loaded="OnLoaded"

View file

@ -140,21 +140,19 @@
Height="40"
Margin="8 5 0 5"
Click="ForwardButton_Click"
Content="&#xe76c;"
DockPanel.Dock="Right"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="18"
IsEnabled="{Binding NextEnabled, Mode=OneWay}" />
IsEnabled="{Binding NextEnabled, Mode=OneWay}">
<ui:FontIcon FontSize="18" Glyph="&#xe76c;" />
</Button>
<Button
x:Name="BackButton"
Width="40"
Height="40"
Click="BackwardButton_Click"
Content="&#xe76b;"
DockPanel.Dock="Right"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="18"
IsEnabled="{Binding BackEnabled, Mode=OneWay}" />
IsEnabled="{Binding BackEnabled, Mode=OneWay}">
<ui:FontIcon FontSize="18" Glyph="&#xe76b;" />
</Button>
<StackPanel />
</DockPanel>