[Proposal] Add BindingBase support for Bind extension methods to simplify nested bindings #416
stephenquan
started this conversation in
New Feature Discussions
Replies: 0 comments 2 replies
-
|
Love it! Let's do it 🙌 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Tentative commit/diff: main...stephenquan:Maui.Markup:feature/bind-extension |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
CommunityToolkit.Maui.Markup currently provides convenient fluent Bind extension methods for BindableObject, covering many common binding scenarios. However, expressing bindings to nested view model properties remains awkward and error‑prone.
For example, developers currently have two main options:
While the second approach is type‑safe, the need to manually specify property change handlers for each level of nesting creates a high barrier to entry and discourages usage. This can be significantly simplified by extending Bind to accept a pre‑constructed BindingBase, leveraging the existing BindingBase.Create API, which already handles nested property tracking:
For reference, the view models used in this example are:
Proposed API
This enhancement can be achieved by adding a single overload to the existing Bind extensions:
GitHub repository
https://github.com/stephenquan/MauiProposedBindOverload
Beta Was this translation helpful? Give feedback.
All reactions