Remove .NET MAUI internals usage#452
Open
jfversluis wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes reliance on .NET MAUI internal APIs from CommunityToolkit.Maui.Markup by replacing internal element/property access and custom internal binding infrastructure with public BindableProperty mappings and public Binding-based typed binding behavior, along with expanded regression tests.
Changes:
- Replaced uses of MAUI internals (e.g.,
FontElement/TextElement/PaddingElement, internal dynamic resource handlers, andTypedBindingBase-derived typed binding) with publicBindablePropertyaccess andBinding/converters. - Added
BindablePropertyHelpersto map supported controls to their publicBindablePropertyequivalents. - Updated/expanded unit tests to validate the new typed-binding behavior and updated property expectations.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Maui.Markup/TypedGesturesExtensions.cs | Updates member-name extraction to avoid treating captured values as bindable paths for typed gesture bindings. |
| src/CommunityToolkit.Maui.Markup/TypedBindingsExtensions.Handlers.cs | Introduces SetTypedBinding implementation using public Binding plus manual source write-back and handler tracking. |
| src/CommunityToolkit.Maui.Markup/TypedBindingExtensions.cs | Switches expression-based typed binding to compute public binding paths (or captured-value fallback) and delegates to SetTypedBinding. |
| src/CommunityToolkit.Maui.Markup/TypedBinding.cs | Removes internal TypedBindingBase-based implementation that depended on MAUI internals. |
| src/CommunityToolkit.Maui.Markup/PlaceholderExtensions.cs | Replaces internal placeholder properties with public property mapping via helpers. |
| src/CommunityToolkit.Maui.Markup/ImageExtensions.cs | Replaces internal image element properties with public property mapping via helpers. |
| src/CommunityToolkit.Maui.Markup/ElementExtensions.cs | Replaces internal font/text/padding properties and narrows dynamic-resource removal to Element. |
| src/CommunityToolkit.Maui.Markup/DynamicResourceHandlerExtensions.cs | Narrows dynamic-resource helpers to public Element API surface. |
| src/CommunityToolkit.Maui.Markup/BindablePropertyHelpers.cs | Adds helper methods that map supported control types to their public BindableProperty equivalents. |
| src/CommunityToolkit.Maui.Markup.UnitTests/BindingHelpers.cs | Updates test reflection helpers to avoid MAUI internal types while still validating bindings. |
| src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs | Adds/updates typed-binding regression tests for captured values, OneWayToSource push behavior, and write-back edge cases. |
| src/CommunityToolkit.Maui.Markup.UnitTests/GesturesExtensionsTests.cs | Updates expectations for typed gesture binding modes under the new binding approach. |
| src/CommunityToolkit.Maui.Markup.UnitTests/TextTests.cs | Updates expected BindableProperty references from internal element properties to public control properties. |
| src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs | Updates font-related expected properties to public control properties. |
| src/CommunityToolkit.Maui.Markup.UnitTests/PaddingElementExtensionsTests.cs | Updates padding tests to use helper-mapped public padding properties. |
| src/CommunityToolkit.Maui.Markup.UnitTests/PaceholderExtensionsTests.cs | Updates placeholder tests to use public placeholder properties. |
| src/CommunityToolkit.Maui.Markup.UnitTests/ImageExtensionTests.cs | Updates image tests to use public image bindable properties. |
| src/CommunityToolkit.Maui.Markup.UnitTests/Mocks/MockApplication.cs | Removes obsolete internal system-resource provider registration. |
| src/CommunityToolkit.Maui.Markup.UnitTests/UnitExpressionSearch.cs | Removes test helper that depended on MAUI internals. |
| src/CommunityToolkit.Maui.Markup.UnitTests/Mocks/MockResourcesProvider.cs | Removes obsolete internal system resource provider implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
63480f5 to
407abc2
Compare
8960a71 to
06644aa
Compare
Replace MAUI internal helper dependencies with public API mappings and public Binding-based typed binding behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Narrow padding and text color helpers back to public supported surfaces, add explicit typed binding removal for setter write-back handlers, and cover the adjusted behavior in tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document RemoveTypedBinding for typed bindings with setter write-back handlers and explain why target-side write-back restores the public binding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Treat conversion-style ConvertBack failures as skipped source updates and cover the behavior with a typed binding regression test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Select Xcode 26.5 for the macOS Build workflow so the .NET iOS and MacCatalyst 26.5 workloads used by the latest .NET 10 SDK do not resolve to Xcode 26.6. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ScrollView and derived ScrollView padding coverage to prove the public overloads remain unambiguous and preserve fluent return types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
06644aa to
2cc6860
Compare
Track source-originated target updates so manual typed-binding write-back does not ConvertBack and overwrite the source during normal source-to-target binding updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Validation
Notes
TypedBinding.cswas removed because publicBindingBasecannot be subclassed equivalently outside MAUI internals. The replacement preserves common path binding behavior and explicit setter write-back using public APIs.Element, matching the public MAUI dynamic-resource API surface.