Skip to content

Feature: Added "Properties" button to the Details Pane #12913

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

Merged
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
17 changes: 17 additions & 0 deletions src/Files.App/UserControls/Pane/PreviewPane.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:properties="using:Files.App.ViewModels.Properties"
xmlns:triggers="using:CommunityToolkit.WinUI.UI.Triggers"
xmlns:usercontrols="using:Files.App.UserControls"
x:Name="Root"
MinWidth="90"
HorizontalAlignment="Stretch"
Expand Down Expand Up @@ -267,6 +268,22 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<!-- Open Properties Button -->
<Button
x:Name="DetailsOpenProperties"
Margin="8,0,8,8"
HorizontalAlignment="Left"
Command="{x:Bind Commands.OpenProperties}"
IsEnabled="{x:Bind Commands.OpenProperties.IsExecutable, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind Commands.OpenProperties.LabelWithHotKey, Mode=OneWay}">
<Button.Content>
<StackPanel Orientation="Horizontal" Spacing="8">
<usercontrols:OpacityIcon Style="{x:Bind Commands.OpenProperties.OpacityStyle}" />
<TextBlock Text="{helpers:ResourceString Name=Properties}" />
</StackPanel>
</Button.Content>
</Button>
</StackPanel>
</ScrollViewer>

Expand Down
8 changes: 3 additions & 5 deletions src/Files.App/UserControls/Pane/PreviewPane.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Extensions;
using Files.App.ViewModels;
using Files.Core.Services.Settings;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
Expand All @@ -25,6 +20,8 @@ public sealed partial class PreviewPane : UserControl

private readonly IPreviewPaneSettingsService PaneSettingsService;

private readonly ICommandManager Commands;

private readonly PreviewPaneViewModel ViewModel;

private ObservableContext Context { get; } = new();
Expand All @@ -33,6 +30,7 @@ public PreviewPane()
{
InitializeComponent();
PaneSettingsService = Ioc.Default.GetRequiredService<IPreviewPaneSettingsService>();
Commands = Ioc.Default.GetRequiredService<ICommandManager>();
ViewModel = Ioc.Default.GetRequiredService<PreviewPaneViewModel>();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Files.App/ViewModels/Previews/FolderPreviewViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ private async Task LoadPreviewAndDetailsAsync()
}

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

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