Skip to content

Commit 035cd39

Browse files
authored
Fix: Fixed file properties when multiple files are selected (#11559)
* Fix properties hanging for multiple files * More fixes
1 parent fb62dcb commit 035cd39

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/Files.App/Views/Properties/MainPropertiesPage.xaml.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
using Microsoft.UI.Xaml.Input;
1616
using Microsoft.UI.Xaml.Navigation;
1717
using System;
18+
using System.Collections.Generic;
1819
using System.Collections.ObjectModel;
20+
using System.Linq;
1921
using System.Threading;
2022
using System.Threading.Tasks;
2123
using Windows.Foundation.Metadata;
@@ -231,8 +233,21 @@ private void AddNavigationViewItemsToControl(object item)
231233

232234
MainPropertiesWindowNavigationView.SelectedItem = generalItem;
233235

234-
// Unable unavailable property tabs
235-
if (item is ListedItem listedItem)
236+
if (item is List<ListedItem> listedItems)
237+
{
238+
var commonFileExt = listedItems.Select(x => x.FileExtension).Distinct().Count() == 1 ? listedItems.First().FileExtension : null;
239+
var compatibilityItemEnabled = listedItems.All(listedItem => FileExtensionHelpers.IsExecutableFile(listedItem is ShortcutItem sht ? sht.TargetPath : commonFileExt, true));
240+
241+
if (!compatibilityItemEnabled)
242+
NavViewItems.Remove(compatibilityItem);
243+
244+
NavViewItems.Remove(libraryItem);
245+
NavViewItems.Remove(shortcutItem);
246+
NavViewItems.Remove(detailsItem);
247+
NavViewItems.Remove(securityItem);
248+
NavViewItems.Remove(customizationItem);
249+
}
250+
else if (item is ListedItem listedItem)
236251
{
237252
var isShortcut = listedItem.IsShortcut;
238253
var isLibrary = listedItem.IsLibrary;

src/Files.App/Views/Properties/SecurityPage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public SecurityPage()
3030
{
3131
InitializeComponent();
3232

33-
OpenAdvancedPropertiesCommand = new RelayCommand(() => OpenAdvancedProperties());
33+
OpenAdvancedPropertiesCommand = new RelayCommand(OpenAdvancedProperties);
3434
}
3535

3636
protected override void OnNavigatedTo(NavigationEventArgs e)
3737
{
38-
var np = e.Parameter as Properties.MainPropertiesPage.PropertyNavParam;
38+
var np = e.Parameter as MainPropertiesPage.PropertyNavParam;
3939

4040
if (np.navParameter is ListedItem listedItem)
4141
{

0 commit comments

Comments
 (0)