uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[Reactive] Add ability to create a state from a standard property

Open dr1rrb opened this issue 3 years ago • 0 comments

What would you like to be added:

Something like:

public interface IService
{
    public bool IsSomething { get; set; }
}

public IState<bool> IsSomething => State.FromProperty(
    _svc, 
    get: svc => svc.IsSomething, 
    set: value => svc.IsSomething = value);

Using the PropertySelector we should be able to declare something like public IState<bool> IsSomething => State.FromProperty(_svc, svc => svc.IsSomething) But for now the PropertySelector is restricted to record

Why is this needed:

To adapt an external component that is not feed aware

Discussion

  1. How do we support changes ? Should we automatically hook to INPC if svc does implement it ? Should we add a delegate to subscribe to custom IsSomethingChanged events ?

dr1rrb avatar Nov 09 '22 14:11 dr1rrb