Description
Unlike Binding, the TypedBinding class doesn't have any mechanism of handling RelativeBindingSource. There doesn't seem to be too much in the way of implementing it though. It seems to me that the only difference in behavior between Binding and TypedBinding should be that once relative source is resolved, we need to validate that it's type is typeof(TSource) or that it is derived from it.
Once we have support for RelativeBindingSource, we should be able to replace all internal uses of Binding with TypedBinding to make the MAUI codebase trimmable (#19995). Also, it would be possible for XamlC to compile more bindings into typed bindings.
Public API Changes
No change to public API.
Intended Use-Case
This change would be needed for #19912:
button.SetBinding(Button.TextProperty, static (Button btn) => btn.Text, source: RelativeBindingSource.TemplatedParent);
Description
Unlike
Binding, theTypedBindingclass doesn't have any mechanism of handlingRelativeBindingSource. There doesn't seem to be too much in the way of implementing it though. It seems to me that the only difference in behavior betweenBindingandTypedBindingshould be that once relative source is resolved, we need to validate that it's type istypeof(TSource)or that it is derived from it.Once we have support for RelativeBindingSource, we should be able to replace all internal uses of Binding with TypedBinding to make the MAUI codebase trimmable (#19995). Also, it would be possible for XamlC to compile more bindings into typed bindings.
Public API Changes
No change to public API.
Intended Use-Case
This change would be needed for #19912: