What is ReactiveProperty

ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target framework is .NET Standard 2.0.

Summary

Concept of ReactiveProperty is Fun programing. You can write MVVM pattern program using ReactiveProperty very fun.

UWP

Following code is tow way binding between ReactiveProperty and plane object property.

class Model : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    private string _name;
    public string Name
    {
        get => _name;
        set
        {
            _name = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
        }
    }
}
class ViewModel
{
    private readonly Model _model = new Model();
    public ReactiveProperty<string> Name { get; }
    public ViewModel()
    {
        // TwoWay synchronize to ReactiveProperty and Model#Name property.
        Name = _model.ToReactivePropertyAsSynchronized(x => x.Name);
    }
}

ReactiveProperty is implemented the IObservable<T>. Yes! You can use LINQ.

var name = new ReactiveProperty<string>();
name.Where(x => x.StartsWith("_")) // filter
    .Select(x => x.ToUpper()) // convert
    .Subscribe(x => { ... some action ... });

ReactiveProperty is created from IObservable<T>.

class ViewModel
{
    public ReactiveProperty<string> Input { get; }
    public ReactiveProperty<string> Output { get; }

    public ViewModel()
    {
        Input = new ReactiveProperty("");
        Output = Input
            .Delay(TimeSpan.FromSecond(1)) // Using a Rx method.
            .Select(x => x.ToUpper()) // Using a LINQ method.
            .ToReactiveProperty(); // Convert to ReactiveProperty
    }
}

This method chain is very cool.

And we provide ReactiveCommand class what implements ICommand and IObservable<T> interfaces. ReactiveCommand can create from an IObservable<bool>

var command = Observable.Interval(TimeSpan.FromSecond(1))
    .Select(x => x % 2 == 0) // convert to IO<bool>
    .ToReactiveCommand();
command.Subscribe(_ =>
{
    // ReactiveCommand invoke an OnNext when Execute method was called.
});

You can start the ReactiveProperty from following links.

And learn to core features on following links.