Skip to content

Commit

Permalink
Fix: Fixed ArgumentException with ShowViewControlButton
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 committed Nov 17, 2023
1 parent 427def8 commit 7f8c927
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Files.App/Actions/Content/Selection/InvertSelectionAction.cs
Expand Up @@ -3,7 +3,7 @@

namespace Files.App.Actions
{
internal class InvertSelectionAction : IAction
internal class InvertSelectionAction : ObservableObject, IAction
{
private readonly IContentPageContext context;

Expand Down Expand Up @@ -41,6 +41,8 @@ public bool IsExecutable
public InvertSelectionAction()
{
context = Ioc.Default.GetRequiredService<IContentPageContext>();

context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
Expand All @@ -49,5 +51,17 @@ public Task ExecuteAsync()

return Task.CompletedTask;
}

private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(IContentPageContext.PageType):
case nameof(IContentPageContext.HasItem):
case nameof(IContentPageContext.ShellPage):
OnPropertyChanged(nameof(IsExecutable));
break;
}
}
}
}

0 comments on commit 7f8c927

Please sign in to comment.