Skip to content

Conversation

@ferrariofilippo
Copy link
Contributor

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.

Notes

  • It seems that Style changes do not invoke OnApplyTemplate, so this solution is basically a workaround.
  • I can't remember if we have anything against Finalizers... should I dispose the object in a different way?

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.

  1. Open a folder
  2. Change the layout using the toolbar's button
  3. See that the icon changes
  4. Try swapping panes
  5. Check if this fixes a similar issue with Cloud Sync Status (I can't test this myself)

@yaira2
Copy link
Member

yaira2 commented Aug 12, 2025

Check if this fixes a similar issue with Cloud Sync Status (I can't test this myself)

I expect it does 👍

It likely fixes an issue we were having with the Omnibar as well.

@yaira2 yaira2 closed this Aug 12, 2025
@yaira2 yaira2 reopened this Aug 12, 2025
@yaira2
Copy link
Member

yaira2 commented Aug 13, 2025

I can't remember if we have anything against Finalizers... should I dispose the object in a different way?

It seems to be causing a crash, it might be more reliable to use the Unloaded event.

@ferrariofilippo
Copy link
Contributor Author

It seems to be causing a crash, it might be more reliable to use the Unloaded event.

My bad, I pushed without testing. Your fix seems to work 👍

@yaira2 yaira2 changed the title Fix: Update toolbar's Layout icon on layout changes Fix: Fixed issue where the 'layout' icon didn't match the select layout Aug 13, 2025
@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label Aug 13, 2025
@yaira2
Copy link
Member

yaira2 commented Aug 13, 2025

@ferrariofilippo thank you for fixing this! I didn't think about debugging this from the control side.

@yaira2 yaira2 requested a review from Copilot August 13, 2025 13:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes an issue where the 'layout' icon in the navigation toolbar didn't update to match the selected layout. The solution implements a workaround for the fact that Style changes don't automatically invoke OnApplyTemplate in WinUI controls.

  • Adds property change callback handling for the Style property in ThemedIcon
  • Re-enables icon display in navigation bar suggestion items
  • Updates template part retrieval and icon state when style changes

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Files.App/UserControls/NavigationToolbar.xaml Uncomments icon display elements and adjusts column layout for navigation bar suggestions
src/Files.App.Controls/ThemedIcon/ThemedIcon.cs Registers callback for Style property changes and handles cleanup on unload
src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs Implements Style property change handler that refreshes icon state

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yaira2 yaira2 merged commit bf16dca into files-community:main Aug 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Toolbar's Layout icon doesn't change

2 participants