Skip to content

Update AppThemeResourceExtension to not use IProvideParentValues #2639

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jfversluis
Copy link
Member

Description of Change

This PR updates AppThemeResourceExtension to not use IProvideParentValues, which is internal to .NET MAUI.

At the .NET MAUI side we're exploring to remove the InternalsVisibleTo for the Toolkit since it shouldn't be necessary.

Most APIs there will be removed with the Popup v2 implementation (yay), the rest are being used in AvatarView and we're OK to make those public on the .NET MAUI side for .NET 10, but the one used in AppThemeResourceExtension we're not OK with making public.

Therefore, this PR explores an alternative implementation that does not use IProvideParentValues

@jfversluis jfversluis added the area/extensions Issue/Discussion/PR that has to do with Extensions label Apr 22, 2025
@jfversluis jfversluis requested a review from Copilot April 22, 2025 20:37
Copy link
Contributor

@Copilot 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 PR refactors the AppThemeResourceExtension to remove the dependency on IProvideParentValues and instead use IProvideValueTarget and IRootObjectProvider for resource lookup. Key changes include:

  • Updating the RequiredService attribute to target IProvideValueTarget and IRootObjectProvider.
  • Replacing the old resource lookup via parent objects with a new strategy that walks the visual tree and falls back to the root object's resources and Application.Current resources.
  • Streamlining error messages and exception handling for cases where resources are missing or invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/extensions Issue/Discussion/PR that has to do with Extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant