Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2-Way Binding to IObservable-like object (+XAML support) #16260

Open
maxkatz6 opened this issue Jul 8, 2024 Discussed in #16257 · 1 comment
Open

2-Way Binding to IObservable-like object (+XAML support) #16260

maxkatz6 opened this issue Jul 8, 2024 Discussed in #16257 · 1 comment

Comments

@maxkatz6
Copy link
Member

maxkatz6 commented Jul 8, 2024

See discussion for more details #16257

Right now, there is no stable API after binding refactoring, that allows creating TwoWay observable bindings, only an obsolete API to be removed in 12. We need to implement a replacement API before that.

Also, we might want to support twoway observable bindings in XAML as well, something that we didn't have before.
It should be possible by checking if target property implements both IObserver and IObservable of the same type.

@maxkatz6 maxkatz6 added this to the 12.0 milestone Jul 8, 2024
@maxkatz6 maxkatz6 changed the title 2-Way Binding to IObservable-like object from XAML 2-Way Binding to IObservable-like object (+XAML support) Jul 8, 2024
@maxkatz6
Copy link
Member Author

maxkatz6 commented Jul 8, 2024

Current obsolete API that still works:

public class InstancedBinding
{
        public static InstancedBinding TwoWay(
            IObservable<object?> observable,
            IObserver<object?> observer,
            BindingPriority priority = BindingPriority.LocalValue);
}

var instancedBinding = InstancedBinding.TwoWay(/* */);
BindingOperations.Apply(menuItem, MenuItem.IsCheckedProperty, instancedBinding);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant