Skip to content

Commit 0ee97de

Browse files
authored
Fix: Fixed issue where custom font wasn't applied to the details pane (#12554)
1 parent d1abba8 commit 0ee97de

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/Files.App/Constants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public static class UI
103103
public const double ContextMenuItemsMaxWidth = 250;
104104
}
105105

106+
public static class Appearance
107+
{
108+
public const string StandardFont = "Segoe UI Variable";
109+
}
110+
106111
public static class Browser
107112
{
108113
public static class GridViewBrowser

src/Files.App/Helpers/AppThemeResourcesHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ public static void LoadAppResources(this IResourcesService service, IAppearanceS
2525
service.SetCompactSpacing(useCompactStyles);
2626
service.SetAppThemeBackgroundColor(appThemeBackgroundColor.FromWindowsColor());
2727

28-
if (!String.IsNullOrWhiteSpace(appThemeAddressBarBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
28+
if (!string.IsNullOrWhiteSpace(appThemeAddressBarBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
2929
service.SetAppThemeAddressBarBackgroundColor(ColorHelper.ToColor(appThemeAddressBarBackgroundColor).FromWindowsColor());
3030
else
3131
appearance.AppThemeAddressBarBackgroundColor = ""; //migrate to new default
3232

33-
if (!String.IsNullOrWhiteSpace(appThemeSidebarBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
33+
if (!string.IsNullOrWhiteSpace(appThemeSidebarBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
3434
service.SetAppThemeSidebarBackgroundColor(ColorHelper.ToColor(appThemeSidebarBackgroundColor).FromWindowsColor());
3535
else
3636
appearance.AppThemeSidebarBackgroundColor = ""; //migrate to new default
3737

38-
if (!String.IsNullOrWhiteSpace(appThemeFileAreaBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
38+
if (!string.IsNullOrWhiteSpace(appThemeFileAreaBackgroundColor) && appThemeAddressBarBackgroundColor != "#00000000")
3939
service.SetAppThemeFileAreaBackgroundColor(ColorHelper.ToColor(appThemeFileAreaBackgroundColor).FromWindowsColor());
4040
else
4141
appearance.AppThemeFileAreaBackgroundColor = ""; //migrate to new default
4242

43-
if (appThemeFontFamily != "Segoe UI Variable")
43+
if (appThemeFontFamily != Constants.Appearance.StandardFont)
4444
service.SetAppThemeFontFamily(appThemeFontFamily);
4545

4646
service.ApplyResources();

src/Files.App/UserControls/Pane/PreviewPane.xaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@
113113
</Setter>
114114
</Style>
115115

116+
<Style x:Key="Local.FileDetailsTextBlockStyle" TargetType="TextBlock">
117+
<Setter Property="FontWeight" Value="Normal" />
118+
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
119+
</Style>
120+
116121
</ResourceDictionary>
117122
</ResourceDictionary.MergedDictionaries>
118123
</ResourceDictionary>
@@ -205,14 +210,14 @@
205210
<TextBlock
206211
x:Name="DetailsListHeader"
207212
HorizontalAlignment="Center"
213+
FontFamily="{ThemeResource ContentControlThemeFontFamily}"
208214
FontSize="20"
209215
FontWeight="Bold"
210216
IsTextSelectionEnabled="True"
211217
Text="{x:Bind ViewModel.SelectedItem.Name, Mode=OneWay}"
212218
TextAlignment="Center"
213219
TextWrapping="Wrap"
214220
Visibility="Collapsed" />
215-
216221
<ItemsControl
217222
x:Name="FileDetailsRepeater"
218223
Margin="12"
@@ -233,7 +238,7 @@
233238
HorizontalAlignment="Stretch"
234239
VerticalAlignment="Center"
235240
MaxLines="2"
236-
Style="{StaticResource BodyTextBlockStyle}"
241+
Style="{StaticResource Local.FileDetailsTextBlockStyle}"
237242
Text="{x:Bind Name, Mode=OneWay}" />
238243

239244
<!-- Value -->
@@ -356,4 +361,4 @@
356361
</VisualStateGroup>
357362
</VisualStateManager.VisualStateGroups>
358363
</Grid>
359-
</UserControl>
364+
</UserControl>

src/Files.App/ViewModels/Previews/FolderPreviewViewModel.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ private async Task LoadPreviewAndDetailsAsync()
4747
GetFileProperty("PropertyDateModified", dateTimeFormatter.ToLongLabel(info.DateModified)),
4848
GetFileProperty("PropertyDateCreated", dateTimeFormatter.ToLongLabel(info.ItemDate)),
4949
GetFileProperty("PropertyItemPathDisplay", Folder.Path),
50+
GetFileProperty("FileTags",
51+
Item.FileTagsUI is not null ? string.Join(',', Item.FileTagsUI.Select(x => x.Name)) : null)
5052
};
51-
52-
Item.FileDetails.Add(GetFileProperty("FileTags",
53-
Item.FileTagsUI is not null ? string.Join(',', Item.FileTagsUI.Select(x => x.Name)) : null));
5453
}
5554

5655
private static FileProperty GetFileProperty(string nameResource, object value)

0 commit comments

Comments
 (0)