-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix: Fixed issue where toolbar button sometimes had the wrong icon state #17032
Conversation
public bool HasAdditionalAction => | ||
InstanceViewModel.IsPageTypeRecycleBin || | ||
Commands.RunWithPowershell.IsExecutable || | ||
CanExtract || | ||
Commands.DecompressArchive.IsExecutable || | ||
Commands.DecompressArchiveHere.IsExecutable || | ||
Commands.DecompressArchiveHereSmart.IsExecutable || | ||
Commands.DecompressArchiveToChildFolder.IsExecutable || | ||
Commands.EditInNotepad.IsExecutable || | ||
Commands.RotateLeft.IsExecutable || | ||
Commands.RotateRight.IsExecutable || | ||
Commands.SetAsAppBackground.IsExecutable || | ||
Commands.SetAsWallpaperBackground.IsExecutable || | ||
Commands.SetAsLockscreenBackground.IsExecutable || | ||
Commands.SetAsSlideshowBackground.IsExecutable || | ||
Commands.InstallFont.IsExecutable || | ||
Commands.InstallInfDriver.IsExecutable || | ||
Commands.InstallCertificate.IsExecutable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public bool HasAdditionalAction => | |
InstanceViewModel.IsPageTypeRecycleBin || | |
Commands.RunWithPowershell.IsExecutable || | |
CanExtract || | |
Commands.DecompressArchive.IsExecutable || | |
Commands.DecompressArchiveHere.IsExecutable || | |
Commands.DecompressArchiveHereSmart.IsExecutable || | |
Commands.DecompressArchiveToChildFolder.IsExecutable || | |
Commands.EditInNotepad.IsExecutable || | |
Commands.RotateLeft.IsExecutable || | |
Commands.RotateRight.IsExecutable || | |
Commands.SetAsAppBackground.IsExecutable || | |
Commands.SetAsWallpaperBackground.IsExecutable || | |
Commands.SetAsLockscreenBackground.IsExecutable || | |
Commands.SetAsSlideshowBackground.IsExecutable || | |
Commands.InstallFont.IsExecutable || | |
Commands.InstallInfDriver.IsExecutable || | |
Commands.InstallCertificate.IsExecutable; | |
public bool HasAdditionalAction => | |
InstanceViewModel.IsPageTypeRecycleBin || | |
Commands.RunWithPowershell.IsExecutable || | |
CanExtract || | |
Commands.DecompressArchive.IsExecutable || | |
Commands.DecompressArchiveHere.IsExecutable || | |
Commands.DecompressArchiveHereSmart.IsExecutable || | |
Commands.DecompressArchiveToChildFolder.IsExecutable || | |
Commands.EditInNotepad.IsExecutable || | |
Commands.RotateLeft.IsExecutable || | |
Commands.RotateRight.IsExecutable || | |
Commands.SetAsAppBackground.IsExecutable || | |
Commands.SetAsWallpaperBackground.IsExecutable || | |
Commands.SetAsLockscreenBackground.IsExecutable || | |
Commands.SetAsSlideshowBackground.IsExecutable || | |
Commands.InstallFont.IsExecutable || | |
Commands.InstallInfDriver.IsExecutable || | |
Commands.InstallCertificate.IsExecutable; |
This might look prettier, since the above is similar to other large statements in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather stick with the current formatting.
context.PageType != ContentPageTypes.RecycleBin && | ||
context.PageType != ContentPageTypes.ZipFolder && | ||
context.PageType != ContentPageTypes.ReleaseNotes && | ||
context.PageType != ContentPageTypes.Settings && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're interested, you can use is, and, or:
context.PageType != ContentPageTypes.RecycleBin && | |
context.PageType != ContentPageTypes.ZipFolder && | |
context.PageType != ContentPageTypes.ReleaseNotes && | |
context.PageType != ContentPageTypes.Settings && | |
context.PageType is not ContentPageTypes.RecycleBin and | |
not ContentPageTypes.ZipFolder and | |
not ContentPageTypes.ReleaseNotes and | |
not ContentPageTypes.Settings && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have the same results here so I would just leave it as is.
if (context.ShellPage is not null && context.ShellPage.SlimContentPage is not null) | ||
{ | ||
var viewModel = context.ShellPage.SlimContentPage.SelectedItemsPropertiesViewModel; | ||
var extensions = context.SelectedItems.Select(selectedItem => selectedItem.FileExtension).Distinct().ToList(); | ||
|
||
viewModel.CheckAllFileExtensions(extensions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic was moved to IsExecutable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary buttons are working well on my end when selecting an image which is when the additional actions like setting it as wallpaper exist.
@jpozo20 thank you for helping fix this issue! |
Resolved / Related Issues
To prevent extra work, all changes to the Files codebase must link to an approved issue marked as
Ready to build
. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.
Comments
The issue only occurs for files with additional actions in the toolbar. I discovered that changing from
x:Load
toVisibility
resolves the issue. However, this introduces a different issue where the overflow button sometimes displays when there were no overflow items. TogglingIsDynamicOverflowEnabled
seems to workaround this issue.