[Proposal] Add a new public API to allow defining TypedBinding in code #19912
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-9.0.0-preview.5.24307.10
proposal/open
t/enhancement ☀️
New feature or request
Milestone
Description
MAUI currently has two general purpose binding classes:
Binding
andTypedBinding<TSource, TProperty>
. TheTypedBinding
class isn't public and it can only be used through XAML code compiled using XamlC or through the .NET MAUI Markup Community Toolkit.I'm proposing a new API which will allow developers to define type-safe bindings directly. There are several nice properties of the new API:
dotnet new maui
#19397)TypedBinding
(*)TypedBinding
constructor and customers don't need to define it manually which would be the case if we just made the class public(*): Based on running the
SpeedTestApply
andSpeedTestSetBC
unit tests in a PoC implementation (net9.0...simonrozsival:maui:typed-binding-from-expression). The PoC also shows that adding System.Linq.Expressions to thedotnet new maui
app adds89,862 B
to the final .ipa (1.25 %)Public API Changes
Intended Use-Case
Currently:
Using the new API:
Notes
Typed bindings still don't support relative binding sources. I suspect this is one of the reasons why the
TypedBinding
type hasn't been made available to public yet and why it's only used by XamlC where it is applicable./cc @StephaneDelcroix
The text was updated successfully, but these errors were encountered: