Skip to content

Commit fbf2cd7

Browse files
authored
Added the option to access drive properties by right clicking on the drive widget (#3285)
1 parent fcd96fd commit fbf2cd7

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

Files/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@
399399
<data name="BaseLayoutContextFlyoutPropertiesFolder.Text" xml:space="preserve">
400400
<value>Properties</value>
401401
</data>
402+
<data name="DrivesWidgetContextFlyoutPropertiesMenuItem.Text" xml:space="preserve">
403+
<value>Properties</value>
404+
</data>
402405
<data name="BaseLayoutItemContextFlyoutExtract.Text" xml:space="preserve">
403406
<value>Extract</value>
404407
</data>

Files/UserControls/Widgets/DrivesWidget.xaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@
108108
<FontIcon FontFamily="{StaticResource CustomGlyph}" Glyph="&#xF107;" />
109109
</MenuFlyoutItem.Icon>
110110
</MenuFlyoutItem>
111+
<MenuFlyoutItem
112+
x:Name="PropertiesItem"
113+
x:Uid="DrivesWidgetContextFlyoutPropertiesMenuItem"
114+
Click="OpenDriveProperties_Click"
115+
DataContext="{x:Bind}"
116+
Text="Properties">
117+
<MenuFlyoutItem.Icon>
118+
<FontIcon FontFamily="{StaticResource FluentUIGlyphs}" Glyph="&#xea8d;" />
119+
</MenuFlyoutItem.Icon>
120+
</MenuFlyoutItem>
111121
<MenuFlyoutItem
112122
x:Name="EjectDevice"
113123
x:Uid="SideBarEjectDevice"

Files/UserControls/Widgets/DrivesWidget.xaml.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ public sealed partial class DrivesWidget : UserControl, INotifyPropertyChanged
2929

3030
public static ObservableCollection<INavigationControlItem> ItemsAdded = new ObservableCollection<INavigationControlItem>();
3131

32+
private IShellPage associatedInstance;
33+
34+
public IShellPage AppInstance
35+
{
36+
get => associatedInstance;
37+
set
38+
{
39+
if (value != associatedInstance)
40+
{
41+
associatedInstance = value;
42+
NotifyPropertyChanged(nameof(AppInstance));
43+
}
44+
}
45+
}
46+
3247
public DrivesWidget()
3348
{
3449
InitializeComponent();
@@ -57,6 +72,12 @@ private async void OpenInNewWindow_Click(object sender, RoutedEventArgs e)
5772
await Interaction.OpenPathInNewWindowAsync(item.Path);
5873
}
5974

75+
private async void OpenDriveProperties_Click(object sender, RoutedEventArgs e)
76+
{
77+
var item = ((MenuFlyoutItem)sender).DataContext as DriveItem;
78+
await AppInstance.InteractionOperations.OpenPropertiesWindowAsync(item);
79+
}
80+
6081
private void Button_Click(object sender, RoutedEventArgs e)
6182
{
6283
string NavigationPath = ""; // path to navigate
@@ -121,4 +142,4 @@ private void MenuFlyout_Opening(object sender, object e)
121142
newPaneMenuItem.Visibility = ShowMultiPaneControls ? Visibility.Visible : Visibility.Collapsed;
122143
}
123144
}
124-
}
145+
}

Files/Views/YourHome.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
x:Class="Files.Views.YourHome"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:converters="using:Files.Converters"
65
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
76
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:converters="using:Files.Converters"
88
xmlns:widgets="using:Files.UserControls.Widgets"
99
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
1010
mc:Ignorable="d">
@@ -16,17 +16,17 @@
1616
<EntranceThemeTransition />
1717
</TransitionCollection>
1818
</StackPanel.ChildrenTransitions>
19-
2019
<widgets:LibraryCards x:Name="LibraryWidget" x:Load="{x:Bind AppSettings.ShowLibraryCardsWidget, Mode=OneWay}" />
2120

2221
<widgets:DrivesWidget
2322
x:Name="DrivesWidget"
2423
x:Load="{x:Bind AppSettings.ShowDrivesWidget, Mode=OneWay}"
25-
ShowMultiPaneControls="{x:Bind converters:MultiBooleanConverter.AndConvert(AppInstance.IsMultiPaneEnabled, AppInstance.IsPageMainPane), Mode=OneWay}" />
24+
ShowMultiPaneControls="{x:Bind converters:MultiBooleanConverter.AndConvert(AppInstance.IsMultiPaneEnabled, AppInstance.IsPageMainPane), Mode=OneWay}"
25+
AppInstance="{x:Bind AppInstance, Mode=OneWay}" />
2626

2727
<widgets:Bundles x:Name="BundlesWidget" x:Load="{x:Bind AppSettings.ShowBundlesWidget, Mode=OneWay}" />
2828

2929
<widgets:RecentFiles x:Name="RecentFilesWidget" x:Load="{x:Bind AppSettings.ShowRecentFilesWidget, Mode=OneWay}" />
3030
</StackPanel>
3131
</ScrollViewer>
32-
</Page>
32+
</Page>

0 commit comments

Comments
 (0)