Repository navigation
feat: Expose PushRequestedThemeForSubTreeByName/PopRequestedThemeForSubTreeByName as public API (backport #23219) - #23248
Merged
agneszitte merged 1 commit intoMay 11, 2026
Conversation
…ubTreeByName as public API Adds public string-accepting overloads of the internal theme-stack methods on ResourceDictionary, marked with [EditorBrowsable(Never)]. This allows external packages (e.g. CSharpMarkup) to manage the theme context without reflection. (cherry picked from commit dafa218)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds public
string-accepting overloads of the internal theme-stack methods onResourceDictionary, marked with[EditorBrowsable(EditorBrowsableState.Never)].This allows external packages (e.g. CSharpMarkup's
ThemeBindingProvider) to manage the theme context without resorting to reflection, which is fragile, trim-unsafe, and breaks when internals change.What
ResourceDictionary.PushRequestedThemeForSubTreeByName(string theme)— pushes the named theme onto the resolution stackResourceDictionary.PopRequestedThemeForSubTreeByName()— pops the current theme from the stackBoth delegate to the existing internal
Themes.PushRequestedThemeForSubTree/PopRequestedThemeForSubTreemethods, leveraging the implicitstring→ResourceKeyconversion.Why
The CSharpMarkup
ThemeBindingProvider(PR unoplatform/uno.csharpmarkup#881) initially uses reflection as a first draft to call internalPushRequestedThemeForSubTree/PopRequestedThemeForSubTree. Reviewers @MartinZikmund and @dr1rrb requested that it would be best to expose a public API from Uno.UI instead.Design decisions
stringparameter instead ofResourceKey: TheResourceKeystruct lives insideinternal class SpecializedResourceDictionary, making it inaccessible to external consumers. The implicit conversion handles bridging internally.ByNamesuffix: Distinguishes from the existing internalResourceKey-accepting overloads.[EditorBrowsable(Never)]: Keeps IntelliSense clean while allowing direct invocation by framework-aware packages.This is an automatic backport of pull request feat: Expose PushRequestedThemeForSubTreeByName/PopRequestedThemeForSubTreeByName as public API #23219 done by Mergify.