-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Feature: Added an action to collapse/expand the sidebar #16422
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
Changes from 10 commits
90d6f5b
54aea3b
7b14ee6
f2d3360
ef98d2e
0ba4b8d
7ef4211
95c2189
1c782a1
1c006f4
80bb0be
82f0d93
2450492
10bfad6
b02f2bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c) 2024 Files Community | ||
| // Licensed under the MIT License. See the LICENSE. | ||
|
|
||
| namespace Files.App.Actions | ||
| { | ||
| internal sealed class ToggleSidebarAction : ObservableObject, IToggleAction | ||
Erquint marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| private readonly SidebarViewModel SidebarViewModel = Ioc.Default.GetRequiredService<SidebarViewModel>(); | ||
|
|
||
| public string Label | ||
| => "ToggleSidebar".GetLocalizedResource(); | ||
|
|
||
| public string Description | ||
| => "ToggleSidebarDescription".GetLocalizedResource(); | ||
|
|
||
| public HotKey HotKey | ||
| => new(Keys.S, KeyModifiers.CtrlAlt); | ||
yaira2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public bool IsOn => | ||
| SidebarViewModel.SidebarDisplayMode is SidebarDisplayMode.Expanded | ||
|
Check failure on line 20 in src/Files.App/Actions/Show/ToggleSidebarAction.cs
|
||
| ? true | ||
| : false; | ||
|
|
||
| public ToggleSidebarAction() | ||
| { | ||
| SidebarViewModel.PropertyChanged += ViewModel_PropertyChanged; | ||
| } | ||
|
|
||
| public Task ExecuteAsync(object? parameter = null) | ||
| { | ||
| SidebarViewModel.SidebarDisplayMode = IsOn | ||
Erquint marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ? SidebarDisplayMode.Expanded | ||
|
Check failure on line 32 in src/Files.App/Actions/Show/ToggleSidebarAction.cs
|
||
| : SidebarDisplayMode.Compact; | ||
|
Check failure on line 33 in src/Files.App/Actions/Show/ToggleSidebarAction.cs
|
||
| return Task.CompletedTask; | ||
| } | ||
|
|
||
| private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
| { | ||
| if (e.PropertyName is nameof(SidebarViewModel.SidebarDisplayMode)) | ||
| OnPropertyChanged(nameof(IsOn)); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.