LibraStack/UnityMvvmToolkit

ObservableAttribue support for private properties

Hellfim opened this issue · 1 comments

Hi! I would like to have an ObservableAttribute support for private properties.

Currently it only supports private fields.

In cases you don't want to expose your private/protected properties, but still want to make them available just to the View having ObservableAttribute on such properties would be a good thing

Hi there,

In the next release, it will be possible to apply ObservableAttribute to fields and properties. And the binding logic will be unified for Properties and Commands.

public class MyViewModel : IBindingContext
{
    [Observable("Count")]
    private readonly IProperty<int> _amount;

    [Observable]
    private readonly ICommand _myCommand;

    [Observable]
    protected IProperty<string> Name { get; }

    [Observable("PreviousPropertyName")]
    public IReadOnlyProperty<string> NewPropertyName { get; }
}