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

Fix: Fixed issue where custom font wasn't applied to the details pane #12554

Merged
merged 8 commits into from
Jun 8, 2023
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
5 changes: 5 additions & 0 deletions src/Files.App/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public static class UI
public const double ContextMenuItemsMaxWidth = 250;
}

public static class Appearance
{
public const string StandardFont = "Segoe UI Variable";
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
}

public static class Browser
{
public static class GridViewBrowser
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Helpers/AppThemeResourcesHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ public static void LoadAppResources(this IResourcesService service, IAppearanceS
service.SetCompactSpacing(useCompactStyles);
service.SetAppThemeBackgroundColor(appThemeBackgroundColor.FromWindowsColor());

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

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

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

if (appThemeFontFamily != "Segoe UI Variable")
if (appThemeFontFamily != Constants.Appearance.StandardFont)
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
service.SetAppThemeFontFamily(appThemeFontFamily);

service.ApplyResources();
Expand Down
11 changes: 8 additions & 3 deletions src/Files.App/UserControls/Pane/PreviewPane.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
</Setter>
</Style>

<Style x:Key="Local.FileDetailsTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down Expand Up @@ -205,14 +210,14 @@
<TextBlock
x:Name="DetailsListHeader"
HorizontalAlignment="Center"
FontFamily="{ThemeResource ContentControlThemeFontFamily}"
FontSize="20"
FontWeight="Bold"
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
IsTextSelectionEnabled="True"
Text="{x:Bind ViewModel.SelectedItem.Name, Mode=OneWay}"
TextAlignment="Center"
TextWrapping="Wrap"
Visibility="Collapsed" />

<ItemsControl
x:Name="FileDetailsRepeater"
Margin="12"
Expand All @@ -233,7 +238,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
MaxLines="2"
Style="{StaticResource BodyTextBlockStyle}"
Style="{StaticResource Local.FileDetailsTextBlockStyle}"
Text="{x:Bind Name, Mode=OneWay}" />

<!-- Value -->
Expand Down Expand Up @@ -356,4 +361,4 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>
</UserControl>
5 changes: 2 additions & 3 deletions src/Files.App/ViewModels/Previews/FolderPreviewViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ private async Task LoadPreviewAndDetailsAsync()
GetFileProperty("PropertyDateModified", dateTimeFormatter.ToLongLabel(info.DateModified)),
GetFileProperty("PropertyDateCreated", dateTimeFormatter.ToLongLabel(info.ItemDate)),
GetFileProperty("PropertyItemPathDisplay", Folder.Path),
GetFileProperty("FileTags",
Item.FileTagsUI is not null ? string.Join(',', Item.FileTagsUI.Select(x => x.Name)) : null)
};

Item.FileDetails.Add(GetFileProperty("FileTags",
Item.FileTagsUI is not null ? string.Join(',', Item.FileTagsUI.Select(x => x.Name)) : null));
}

private static FileProperty GetFileProperty(string nameResource, object value)
Expand Down