Skip to content
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
11 changes: 11 additions & 0 deletions src/Files/UserControls/SidebarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Files.Helpers"
xmlns:local="using:Files.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mconv="using:Microsoft.Toolkit.Uwp.UI.Converters"
Expand All @@ -21,6 +22,15 @@
mc:Ignorable="d">
<muxc:NavigationView.Resources>
<ResourceDictionary>
<MenuFlyout x:Key="SidebarContextMenu">
<ToggleMenuFlyoutItem IsChecked="{Binding ShowFavoritesSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=SidebarFavorites}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowLibrarySection, Mode=TwoWay}" Text="{helpers:ResourceString Name=SidebarLibraries}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowDrivesSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=Drives}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowCloudDrivesSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=SidebarCloudDrives}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowNetworkDrivesSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=SidebarNetworkDrives}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowWslSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=WSL}" />
<ToggleMenuFlyoutItem IsChecked="{Binding ShowFileTagsSection, Mode=TwoWay}" Text="{helpers:ResourceString Name=FileTags}" />
</MenuFlyout>
<DataTemplate x:Key="LocationNavItem" x:DataType="navigationcontrolitems:LocationItem">
<muxc:NavigationViewItem
AllowDrop="True"
Expand Down Expand Up @@ -173,6 +183,7 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
RightTapped="PaneRoot_RightTapped"
Visibility="Collapsed">

<Grid.BackgroundTransition>
Expand Down
8 changes: 8 additions & 0 deletions src/Files/UserControls/SidebarControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ private async void Sidebar_PointerPressed(object sender, PointerRoutedEventArgs
}
}

private void PaneRoot_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
var sidebarContextMenu = this.FindResource("SidebarContextMenu") as MenuFlyout;
sidebarContextMenu.ShowAt(this, new Windows.UI.Xaml.Controls.Primitives.FlyoutShowOptions() { Position = e.GetPosition(this) });

e.Handled = true;
}

private void NavigationViewLocationItem_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
var itemContextMenuFlyout = new Microsoft.UI.Xaml.Controls.CommandBarFlyout();
Expand Down
112 changes: 112 additions & 0 deletions src/Files/ViewModels/SidebarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,97 @@ public bool IsSidebarOpen
}
}

public bool ShowFavoritesSection
{
get => UserSettingsService.AppearanceSettingsService.ShowFavoritesSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowFavoritesSection)
{
UserSettingsService.AppearanceSettingsService.ShowFavoritesSection = value;
App.SidebarPinnedController.Model.UpdateFavoritesSectionVisibility();
}
}
}

public bool ShowLibrarySection
{
get => UserSettingsService.AppearanceSettingsService.ShowLibrarySection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowLibrarySection)
{
UserSettingsService.AppearanceSettingsService.ShowLibrarySection = value;
App.LibraryManager.UpdateLibrariesSectionVisibility();
}
}
}

public bool ShowDrivesSection
{
get => UserSettingsService.AppearanceSettingsService.ShowDrivesSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowDrivesSection)
{
UserSettingsService.AppearanceSettingsService.ShowDrivesSection = value;
App.DrivesManager.UpdateDrivesSectionVisibility();
}
}
}

public bool ShowCloudDrivesSection
{
get => UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection)
{
UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection = value;
App.CloudDrivesManager.UpdateCloudDrivesSectionVisibility();
}
}
}

public bool ShowNetworkDrivesSection
{
get => UserSettingsService.AppearanceSettingsService.ShowNetworkDrivesSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowNetworkDrivesSection)
{
UserSettingsService.AppearanceSettingsService.ShowNetworkDrivesSection = value;
App.NetworkDrivesManager.UpdateNetworkDrivesSectionVisibility();
}
}
}

public bool ShowWslSection
{
get => UserSettingsService.AppearanceSettingsService.ShowWslSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowWslSection)
{
UserSettingsService.AppearanceSettingsService.ShowWslSection = value;
App.WSLDistroManager.UpdateWslSectionVisibility();
}
}
}

public bool ShowFileTagsSection
{
get => UserSettingsService.AppearanceSettingsService.ShowFileTagsSection;
set
{
if (value != UserSettingsService.AppearanceSettingsService.ShowFileTagsSection)
{
UserSettingsService.AppearanceSettingsService.ShowFileTagsSection = value;
App.FileTagsManager.UpdateFileTagsSectionVisibility();
}
}
}

private INavigationControlItem selectedSidebarItem;

public INavigationControlItem SidebarSelectedItem
Expand Down Expand Up @@ -143,6 +234,27 @@ private void UserSettingsService_OnSettingChangedEvent(object sender, EventArgum
OnPropertyChanged(nameof(IsSidebarOpen));
}
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowFavoritesSection):
OnPropertyChanged(nameof(ShowFavoritesSection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowLibrarySection):
OnPropertyChanged(nameof(ShowLibrarySection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowCloudDrivesSection):
OnPropertyChanged(nameof(ShowCloudDrivesSection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowDrivesSection):
OnPropertyChanged(nameof(ShowDrivesSection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowNetworkDrivesSection):
OnPropertyChanged(nameof(ShowNetworkDrivesSection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowWslSection):
OnPropertyChanged(nameof(ShowWslSection));
break;
case nameof(UserSettingsService.AppearanceSettingsService.ShowFileTagsSection):
OnPropertyChanged(nameof(ShowFileTagsSection));
break;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Files/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
IsPaneOpen="{x:Bind SidebarAdaptiveViewModel.IsSidebarOpen, Mode=TwoWay}"
IsPaneToggleButtonVisible="False"
Loaded="SidebarControl_Loaded"
DataContext="{x:Bind SidebarAdaptiveViewModel}"
PaneDisplayMode="Left"
SelectedSidebarItem="{x:Bind SidebarAdaptiveViewModel.SidebarSelectedItem, Mode=TwoWay}">
<controls:SidebarControl.TabContent>
Expand Down