Search code examples
wpfdata-bindingreactiveui

Does the underlying data binding of ReactiveUI in WPF use the native implementation of WPF?


Recently I am using ReactiveUI to make a WPF program. I am curious. When I use ReactiveUI for data binding, such as binding the string property of ViewModel to a TextBox.Text, does it use the native implementation of WPF to achieve binding? In fact, I’m not very familiar with the two, so I want to know the relationship between them


Solution

  • It doesn't use the Binding class from WPF binding engine.

    Instead it subscribes to the INotifyPropertyChanged, IReactiveObject, and DependencyProperty subscriptions directly and then will update the view/view model properties directly.

    It has a concept of a ICreatesObservable class internally which describes how to get an observable for a property. These observables are triggered when the property is changed/changing. So for instance on WPF you'll have a ICreatesObservable for DependencyObject/DependencyProperty classes. It'll then combine these observables together to achieve the binding.