Repository navigation
Element-level theming - #22803
Element-level theming#22803
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces element-level theming support so FrameworkElement.RequestedTheme can act as a true theme boundary (WinUI-like) for ThemeResource resolution, theme propagation, and ActualTheme behavior across a subtree.
Changes:
- Add per-element theme state and a WinUI-aligned internal
Themerepresentation and helpers. - Implement theme propagation + push/pop theme context during loading, theme walks, and binding/resource updates.
- Add extensive runtime tests validating
RequestedThemeinheritance, nested boundaries, and ThemeResource resolution.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/UI/Xaml/UIElement.cs | Adds internal per-element theme state and re-entrancy guard used by theme walks. |
| src/Uno.UI/UI/Xaml/Theming.cs | Introduces internal Theme enum + conversion helpers to/from ElementTheme. |
| src/Uno.UI/UI/Xaml/ResourceDictionary.cs | Adds a global “requested theme for subtree” stack to influence themed resource lookup. |
| src/Uno.UI/UI/Xaml/FrameworkElement.cs | Implements theme propagation, push/pop theme context, updated ActualTheme semantics, and Foreground “freeze” logic at theme boundaries. |
| src/Uno.UI/UI/Xaml/Data/BindingHelper.cs | Pushes element theme context when updating resource bindings outside a theme walk. |
| src/Uno.UI/UI/Xaml/Application.cs | Adjusts theme-resource propagation to respect theme boundaries. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_ElementTheme.cs | Adds runtime test coverage for element-level theming scenarios (propagation, ThemeResources, nested boundaries). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
1 similar comment
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
1 similar comment
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/Uno.UI/UI/Xaml/FrameworkElement.cs:1378
ActualThemeChangedis no longer raised fromUpdateThemeBindingsonResourceUpdateReason.ThemeResource(app/system theme changes). SinceNotifyThemeChangedCoreis only invoked on element-level theme changes, elements withRequestedTheme=Defaultmay stop raisingActualThemeChangedwhen the application theme changes, which is a behavioral regression vs the previous implementation.
updateReason,
resourceContextProvider: this);
// Don't fire ActualThemeChanged here anymore - it's now fired
// in NotifyThemeChangedCore when the theme actually changes
}
#region AutomationPeer
#if !__APPLE_UIKIT__ && !__ANDROID__ // This code is generated in FrameworkElementMixins
private AutomationPeer _automationPeer;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
1 similar comment
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
2ad0eda to
8ad13ff
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22803/wasm-skia-net9/index.html |
|
The build 202813 found UI Test snapshots differences: Details
|
|
The build 202813 found UI Test snapshots differences: Details
|
GitHub Issue: closes #3302
PR Type:
What is the current behavior? 🤔
What is the new behavior? 🚀
PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information ℹ️