LibraStack/UnityMvvmToolkit

ReadOnlyPropertyWrapper doesn't report value changes

Hellfim opened this issue · 1 comments

ReadOnlyPropertyWrapper<TSource, TValue> doesn't have functionality to report value changes

It happens because ValueChanged event is intentionally never invoked inside ReadOnlyPropertyWrapper.
It leads to incorrect and unexpected behaviour which might be illustrated with following example

public class MyService
{
    public IReadOnlyProperty<Int32> MyProperty => _myProperty;

    private IProperty<Int32> _myProperty = new Property<Int32>();
}

public class MyViewModel : IBindingContext
{
    [Observable("MyReadOnlyProperty")]
    private IReadOnlyProperty<Int32> _myReadOnlyProperty;

    public MyViewModel(MyService myService)
    {
        _myReadOnlyProperty = myService.MyProperty;
    }
}

Suppose MyReadOnlyProperty property is bound to BindableLabel.
Now, whenever MyService internally changes property value BindableLabel doesn't receive a callback from the wrapper and is never updated