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
When you bind an instance of R3.BindableReactiveProperty<T> to a WinForms control using its DataBindings property, changes on the Value property of the instance are not notified to the control.
This behavior differs from Reactive.Bindings.ReactiveProperty<T>, which works as expected.
Reproduction
Here's a minimal snippet:
publicpartialclassForm1{// label1 and button1 are defined in the code behindprivatereadonlyBindableReactiveProperty<string>rp=new("");publicForm1(){
InitializeComponent();// Bind label1.Text to rp.Value
label1.DataBindings.Add("Text", rp,"Value");}publicvoidbutton1_Click(){// This change won't be notified to label1
rp.Value +="X";}}
Cause
The problem lies in event registration, which is eventually achieved by the AddValueChanged method of the ReflectPropertyDescriptor instance corresponding to the Value property.
This method checks the following conditions:
Does the component type have an event named <propertyName>Changed? (i.e. ValueChanged)
Does the component type implement INotifyPropertyChanged interface?
The issue arises because the "component type" here is ReactiveProperty<T>, rather than BindableReactiveProperty<T>, since the Value property is defined in the former.
Unlike the Reactive.Bindings version, where the event and the property are defined simultaneously, neither condition 1. nor 2. is met.
As a result, the property is recognized as "not supporting change events."
You can verify this:
Sorry for the delay in replying.
Thank you for the detailed report!
Thanks to you, we were able to recognize the problem and fix it.
We will release it in the next release.
Phenomenon
When you bind an instance of
R3.BindableReactiveProperty<T>
to a WinForms control using itsDataBindings
property, changes on theValue
property of the instance are not notified to the control.This behavior differs from
Reactive.Bindings.ReactiveProperty<T>
, which works as expected.Reproduction
Here's a minimal snippet:
Cause
The problem lies in event registration, which is eventually achieved by the
AddValueChanged
method of theReflectPropertyDescriptor
instance corresponding to theValue
property.This method checks the following conditions:
<propertyName>Changed
? (i.e.ValueChanged
)INotifyPropertyChanged
interface?The issue arises because the "component type" here is
ReactiveProperty<T>
, rather thanBindableReactiveProperty<T>
, since theValue
property is defined in the former.Unlike the
Reactive.Bindings
version, where the event and the property are defined simultaneously, neither condition 1. nor 2. is met.As a result, the property is recognized as "not supporting change events."
You can verify this:
I hope this clarifies the issue and helps you improve the package.
The text was updated successfully, but these errors were encountered: