You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We agreed to implement a new public API to allow creating "compiled" bindings (TypedBinding<TSource, TProperty>) in code via source-generators and interceptors based on the proposal #20574 (see Alternative design).
Introduce new public method BindableObjectExtensions.SetBinding<TSource, TProperty>(BindableProperty property, Func<TSource, TProperty> getter, ...) as defined in the proposal
Create a new source generator
Intercept calls to SetBinding<TSource, TProperty>(...)
Parse getter lambda expression
Implement support for properties
Implement support for indexers
Implement support for as-casts
Implement support for C-style casts
Implement support for conditional access to members
Implement diagnostics reporting
Build cacheable data model
Generate setter from the getter lambda
Generate handlers array from the getter lambda
Enable the source generator by default in MAUI apps
Introduce a feature switch to disable the source generator
Add unit tests for correct caching of the generated code
Run benchmarks comparing reflection-based binding, source-generated binding, and hand-written typed binding
We agreed to implement a new public API to allow creating "compiled" bindings (
TypedBinding<TSource, TProperty>) in code via source-generators and interceptors based on the proposal #20574 (see Alternative design).BindableObjectExtensions.SetBinding<TSource, TProperty>(BindableProperty property, Func<TSource, TProperty> getter, ...)as defined in the proposalSetBinding<TSource, TProperty>(...)as-castsWrite docs/developer guide- tracked in .NET MAUI 9: Compiled bindings can be used with C# markup docs-maui#2304Possible future improvements
TypedBinding.ForSingleNestingLevel(...)with the source generated interceptors - [Binding SG] Dogfood binding source generator in the MAUI codebase #23393BindingBase Binding.Create<TSource, TProperty>(Func<TSource, TProperty> getter, ...)TBindable Bind<TBindable, TSource, TProperty>(this TBindable bindableObject, Func<TSource, TProperty> getter, ...) where TBindable : BindableObject.SetBindingwith the samegettersignature into one interceptor