Repository navigation
[Windows] Shell: Apply TabBarDisabledColor to disabled tabs - #35885
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35885Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35885" |
|
/review -b feature/enhanced-reviewer |
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions?
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
|
@Dhivya-SF4094, is this PR ready for review? If it still needs work, please keep it as a draft; otherwise, please mark it ready for review. |
|
Reviewed the AI summary, investigated the concerns, and addressed the valid ones. |
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Nested-item coverage is missing, and the PR description inaccurately describes the implemented ordering.
2 open findings
What changed in this PR
Applies Shell TabBarDisabledColor to disabled Windows tab icons and text, including dynamically added tabs.
Changes:
- Adds disabled foreground handling to Windows navigation items.
- Reapplies Shell appearance after menu synchronization.
- Enables Windows UI coverage and adds a device test.
| File | Description |
|---|---|
NavigationViewItemViewModel.cs |
Tracks and applies disabled foregrounds. |
NavigationViewExtensions.cs |
Propagates disabled colors and WinUI resources. |
Issue32995.cs (UI test) |
Enables Windows screenshot validation. |
Issue32995.cs (HostApp) |
Contains whitespace-only formatting changes. |
ShellTabBarTests.Windows.cs |
Tests dynamically added disabled tabs. |
ShellItemHandler.Windows.cs |
Applies disabled appearance after item mapping. |
🧠 Review effort: Balanced
| if (_shellAppearanceElement is not null) | ||
| { | ||
| UpdateAppearance(_shellAppearanceElement); |
| if (item.MenuItemsSource is { } subItems) | ||
| { | ||
| foreach (var subItem in subItems) | ||
| { | ||
| subItem.DisabledForeground = brush; |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: - When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color. - Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update. ### Root Cause: **Missing TabBarDisabledColor application** - UpdateAppearance() never propagated EffectiveTabBarDisabledColor to the native WinUI controls, so the configured TabBarDisabledColor was ignored and the default system disabled color was used instead. **Incorrect initial disabled icon color** - During SetValues(), IsEnabled was assigned before the disabled foreground brush. As a result, UpdateForeground()executed before DisabledForeground was available, causing the icon to use the default foreground. - In addition, WinUI applies its Disabled visual state immediately when IsEnabled changes, which could override the custom icon foreground during the initial load. ### Description of change: - Added UpdateTopNavigationViewItemDisabledColor() to apply the disabled text color through the WinUI TopNavigationViewItemForegroundDisabled theme resource and propagate the disabled foreground brush to existing NavigationViewItemViewModel instances. - Added a DisabledForeground property to NavigationViewItemViewModel and updated the foreground logic to use it whenever the item is disabled. - Updated the icon setter to reapply the foreground after the icon element is created, ensuring the custom disabled color overrides WinUI's initial visual-state transition. - Updated ShellItemHandler.Windows so UpdateAppearance() applies the disabled color, and reordered SetValues() to assign DisabledForeground before IsEnabled, ensuring the correct brush is available when the disabled state is applied. ### Validated the behavior in the following platforms - [ ] Android - [x] Windows - [ ] iOS - [ ] Mac ### Fixes Fixes #34738 ### Screenshots | Before | After | |---------|--------| | <img width="1250" height="907" src="https://github.com/user-attachments/assets/c8980378-7f4c-414d-ba68-d1760f24c8f6"> | <img width="1250" height="907" src="https://github.com/user-attachments/assets/9a5a6a5f-2301-4d75-95f8-27306c97072e"> |

Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details:
When a Tab is disabled (IsEnabled = false), the TabBarDisabledColor property is expected to change the icon and text color of the disabled Tab. On windows the TabBarDisabledColor is not applied, and the TabBar continues to use the default system disabled color.
Additionally, on the initial load, only the tab text appeared disabled while the tab icon continued to display with the enabled color until a later update.
Root Cause:
Missing TabBarDisabledColor application
Incorrect initial disabled icon color
Description of change:
Validated the behavior in the following platforms
Fixes
Fixes #34738
Screenshots