Skip to content

Commit a5d3844

Browse files
Feature: Added "Properties" button to the Details Pane (#12913)
1 parent e1f43cc commit a5d3844

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1010
xmlns:properties="using:Files.App.ViewModels.Properties"
1111
xmlns:triggers="using:CommunityToolkit.WinUI.UI.Triggers"
12+
xmlns:usercontrols="using:Files.App.UserControls"
1213
x:Name="Root"
1314
MinWidth="90"
1415
HorizontalAlignment="Stretch"
@@ -267,6 +268,22 @@
267268
</DataTemplate>
268269
</ItemsControl.ItemTemplate>
269270
</ItemsControl>
271+
272+
<!-- Open Properties Button -->
273+
<Button
274+
x:Name="DetailsOpenProperties"
275+
Margin="8,0,8,8"
276+
HorizontalAlignment="Left"
277+
Command="{x:Bind Commands.OpenProperties}"
278+
IsEnabled="{x:Bind Commands.OpenProperties.IsExecutable, Mode=OneWay}"
279+
ToolTipService.ToolTip="{x:Bind Commands.OpenProperties.LabelWithHotKey, Mode=OneWay}">
280+
<Button.Content>
281+
<StackPanel Orientation="Horizontal" Spacing="8">
282+
<usercontrols:OpacityIcon Style="{x:Bind Commands.OpenProperties.OpacityStyle}" />
283+
<TextBlock Text="{helpers:ResourceString Name=Properties}" />
284+
</StackPanel>
285+
</Button.Content>
286+
</Button>
270287
</StackPanel>
271288
</ScrollViewer>
272289

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.Mvvm.ComponentModel;
5-
using CommunityToolkit.Mvvm.DependencyInjection;
6-
using Files.App.Extensions;
7-
using Files.App.ViewModels;
8-
using Files.Core.Services.Settings;
94
using Microsoft.UI.Xaml;
105
using Microsoft.UI.Xaml.Controls;
116
using Microsoft.UI.Xaml.Input;
@@ -25,6 +20,8 @@ public sealed partial class PreviewPane : UserControl
2520

2621
private readonly IPreviewPaneSettingsService PaneSettingsService;
2722

23+
private readonly ICommandManager Commands;
24+
2825
private readonly PreviewPaneViewModel ViewModel;
2926

3027
private ObservableContext Context { get; } = new();
@@ -33,6 +30,7 @@ public PreviewPane()
3330
{
3431
InitializeComponent();
3532
PaneSettingsService = Ioc.Default.GetRequiredService<IPreviewPaneSettingsService>();
33+
Commands = Ioc.Default.GetRequiredService<ICommandManager>();
3634
ViewModel = Ioc.Default.GetRequiredService<PreviewPaneViewModel>();
3735
}
3836

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ private async Task LoadPreviewAndDetailsAsync()
6565
}
6666

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

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

0 commit comments

Comments
 (0)