ReactiveProperty 8.0.0-pre202110161410

This is a prerelease version of ReactiveProperty.
There is a newer version of this package available.
See the version list below for details.
Install-Package ReactiveProperty -Version 8.0.0-pre202110161410
dotnet add package ReactiveProperty --version 8.0.0-pre202110161410
<PackageReference Include="ReactiveProperty" Version="8.0.0-pre202110161410" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReactiveProperty --version 8.0.0-pre202110161410
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ReactiveProperty, 8.0.0-pre202110161410"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ReactiveProperty as a Cake Addin
#addin nuget:?package=ReactiveProperty&version=8.0.0-pre202110161410&prerelease

// Install ReactiveProperty as a Cake Tool
#tool nuget:?package=ReactiveProperty&version=8.0.0-pre202110161410&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Japanese

ReactiveProperty

ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target framework is .NET 6.0(on v8.0.0-pre), .NET Core 3.1, .NET Framework 4.6.1 and .NET Standard 2.0.

Build and Release

ReactiveProperty overview

ReactiveProperty is a very powerful and simple library.

Delay and Select

This sample app's ViewModel code is as below:

public class MainPageViewModel
{
    public ReactiveProperty<string> Input { get; }
    public ReadOnlyReactiveProperty<string> Output { get; }
    public MainPageViewModel()
    {
        Input = new ReactiveProperty<string>("");
        Output = Input
            .Delay(TimeSpan.FromSeconds(1))
            .Select(x => x.ToUpper())
            .ToReadOnlyReactiveProperty();
    }
}

It's LINQ and Rx magic.

All steps are written in the "Getting Started" section in the ReactiveProperty documentation.

This library's concept is "Fun programing". ViewModel code using ReactiveProperties is very simple.

ViewModel's popular implementation:

public class AViewModel : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    private string _name;
    public string Name
    {
        get => _name;
        set
        {
            _name = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));

            // Update a command status
            DoSomethingCommand.RaiseCanExecuteChanged();
        }
    }

    private string _memo;
    public string Memo
    {
        get => _memo;
        set
        {
            _memo = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Memo)));

            // Update a command status
            DoSomethingCommand.RaiseCanExecuteChanged();
        }
    }

    // DelegateCommand is plane ICommand implementation.
    public DelegateCommand DoSomethingCommand { get; }

    public AViewModel()
    {
        DoSomethingCommand = new DelegateCommand(
            () => { ... },
            () => !string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Memo)
        );
    }
}

Binding code:

<TextBlock Text="{Binding Name}">
<TextBlock Text="{Binding Memo}">

ViewModel's implementation using ReactiveProperty:

public class AViewModel
{
    public ReactiveProperty<string> Name { get; }
    public ReactiveProperty<string> Memo { get; }
    public ReactiveCommand DoSomethingCommand { get; }

    public AViewModel()
    {
        Name = new ReactiveProperty<string>()
            .SetValidateNotifyError(x => string.IsNullOrEmpty(x) ? "Invalid value" : null);
        Memo = new ReactiveProperty<string>()
            .SetValidateNotifyError(x => string.IsNullOrEmpty(x) ? "Invalid value" : null);
        DoSomethingCommand = new[]
            {
                Name.ObserveHasErrors,
                Memo.ObserveHasErrors,
            }
            .CombineLatestValuesAreAllFalse()
            .ToReactiveCommand()
            .WithSubscribe(() => { ... });
    }
}

Binding code:

<TextBlock Text="{Binding Name.Value}">
<TextBlock Text="{Binding Memo.Value}">

It's very simple.

ReactiveProperty doesn't provide base class by ViewModel, which means that ReactiveProperty can be used together with another MVVM library like Prism, MVVMLight, etc...

Documentation

ReactiveProperty documentation

NuGet packages

Package Id Version and downloads Description
ReactiveProperty The package includes all core features, and the target platform is .NET Standard 2.0. It fits almost all situations.
ReactiveProperty.Core The package includes minimum classes such as ReactivePropertySlim<T> and ReadOnlyReactivePropertySlim<T>. And this doesn't have any dependency even System.Reactive. If you don't need Rx features, then it fits.
ReactiveProperty.WPF The package includes EventToReactiveProperty and EventToReactiveCommand for WPF. This is for .NET Core 3.0 or later and .NET Framework 4.6.1 or later.
ReactiveProperty.UWP The package includes EventToReactiveProperty and EventToReactiveCommand for UWP.
ReactiveProperty.XamarinAndroid The package includes many extension methods to create IObservable from events for Xamarin.Android native.
ReactiveProperty.XamariniOS The package includes many extension methods to bind ReactiveProperty and ReactiveCommand to Xamarin.iOS native controls.

Support

I'm not watching StackOverflow and other forums to support ReactiveProperty, so please feel free to post questions at Github issues. I'm available Japanese(1st language) and English(2nd language).

If too many questions are posted, then I plan to separate posting place about feature requests, issues, questions.

Author info

Yoshifumi Kawai a.k.a. @neuecc is Founder/CEO/CTO of Cysharp, Inc in Tokyo, Japan. Awarded Microsoft MVP for Developer Technologies since April, 2011. He is an original owner of ReactiveProperty.

Takaaki Suzuki a.k.a. @xin9le software developer in Fukui, Japan. Awarded Microsoft MVP for Developer Technologies since July, 2012.

Kazuki Ota a.k.a. @okazuki software developer in Tokyo, Japan. Awarded Microsoft MVP for Windows Development since July 2011 to Feb 2017. Now, working at Microsoft Japan.

NuGet packages (15)

Showing the top 5 NuGet packages that depend on ReactiveProperty:

Package Downloads
MessagePack.ReactiveProperty

Extremely Fast MessagePack Serializer for C#(.NET, .NET Core, Unity, Xamarin). Extension support for ReactiveProperty.

ReactiveProperty.WPF

ReactiveProperty.WPF provides behaviors such as EventToReactiveCommand and EventToReactiveProperty.

Rx.Community.Extensions

Community-written extension methods to Rx

Reactive.ViewModels

Description

ReactiveProperty.XamarinAndroid

ReactiveProperty.XamarinAndroid provides many useful extension methods for Xamarin.Android that can be used with ReactiveProperty.

GitHub repositories (14)

Showing the top 5 popular GitHub repositories that depend on ReactiveProperty:

Repository Stars
MathewSachin/Captura
Capture Screen, Audio, Cursor, Mouse Clicks and Keystrokes
neuecc/MessagePack-CSharp
Extremely Fast MessagePack Serializer for C#(.NET, .NET Core, Unity, Xamarin). / msgpack.org[C#]
runceel/ReactiveProperty
ReactiveProperty provides MVVM and asynchronous support features under Reactive Extensions. Target frameworks are .NET 6, .NET Core 3.1, .NET Framework 4.6.1 and .NET Standard 2.0.
muak/AiForms.SettingsView
SettingsView for Xamarin.Forms
danm-de/pcsc-sharp
PC/SC wrapper classes for .NET, written in C#
Version Downloads Last updated
8.0.2 1,258 11/21/2021
8.0.1 285 11/20/2021
8.0.1-pre202111200140 409 11/20/2021
8.0.0 961 11/9/2021
8.0.0-pre202111090825 84 11/9/2021
8.0.0-pre202110240626 346 10/24/2021
8.0.0-pre202110161410 220 10/16/2021
8.0.0-pre202110160852 107 10/16/2021
8.0.0-pre202110160831 133 10/16/2021
8.0.0-pre202110131323 130 10/13/2021
8.0.0-pre202110071401 166 10/7/2021
8.0.0-pre202110060758 166 10/6/2021
8.0.0-pre202110060735 86 10/6/2021
8.0.0-pre202109190434 258 9/19/2021
8.0.0-pre202109160117 153 9/16/2021
8.0.0-pre202108141424 233 8/14/2021
8.0.0-pre202107040319 563 7/4/2021
7.12.0 8,539 8/6/2021
7.11.0 8,490 5/31/2021
7.10.0 5,431 4/29/2021
7.9.0 4,293 4/20/2021
7.8.3 5,966 3/24/2021
7.8.2 297 3/23/2021
7.8.1 1,842 3/11/2021
7.8.1-pre202103031133 244 3/3/2021
7.8.0 4,358 2/21/2021
7.8.0-pre202102210255 160 2/21/2021
7.8.0-pre202102201703 153 2/20/2021
7.7.1 497 2/19/2021
7.7.1-pre202102190925 167 2/19/2021
7.7.0 6,024 1/26/2021
7.6.1 1,863 1/15/2021
7.6.0 106,454 1/13/2021
7.5.1 19,388 10/19/2020
7.5.0 505 10/17/2020
7.5.0-pre202010141113 261 10/14/2020
7.4.1 9,324 9/23/2020
7.4.0 1,072 9/18/2020
7.3.0 483 9/17/2020
7.2.1 13,025 9/11/2020
7.2.0 23,776 8/4/2020
7.1.0 43,899 5/26/2020
7.1.0-pre202005251107 316 5/25/2020
7.0.1 1,960 5/14/2020
7.0.1-pre202005131606 274 5/13/2020
7.0.0 3,580 5/5/2020
7.0.0-ci20200503102823 293 5/3/2020
7.0.0-ci20200503100450 276 5/3/2020
6.2.0 19,681 1/17/2020
6.1.4 12,754 11/16/2019
6.1.3 14,933 9/26/2019
6.1.2 10,549 8/31/2019
6.0.3 6,788 7/26/2019
5.6.0 84,691 6/20/2019
5.5.1 29,284 5/22/2019
5.4.0 6,902 4/3/2019
5.4.0-pre1 708 4/3/2019
5.3.2 23,235 12/14/2018
5.3.1 1,227 12/13/2018
5.3.0 43,865 9/28/2018
5.2.0 10,172 8/2/2018
5.1.1 4,039 6/21/2018
5.0.0 3,791 6/3/2018
4.2.2 53,217 4/20/2018
4.2.1 3,913 3/17/2018
4.2.0 8,716 1/28/2018
4.1.1 2,091 1/20/2018
4.1.0 1,373 1/18/2018
4.0.1-pre1 1,021 1/14/2018
4.0.0 3,879 1/8/2018
4.0.0-pre5 1,041 1/6/2018
4.0.0-pre4 1,934 10/21/2017
4.0.0-pre3 1,503 6/16/2017
3.6.0 23,405 3/27/2017
3.5.1 16,982 3/3/2017
3.5.0 3,251 2/15/2017
3.4.0 4,835 11/30/2016
3.3.2 1,920 11/21/2016
3.3.1 2,096 11/15/2016
3.2.0 20,001 10/10/2016
3.1.0 1,344 10/7/2016
3.0.1 4,061 8/13/2016
3.0.0 7,979 8/12/2016
3.0.0-pre5 1,159 7/20/2016
3.0.0-pre4 1,186 7/9/2016
3.0.0-pre3 1,090 7/9/2016
3.0.0-pre2 1,046 7/9/2016
3.0.0-pre1 1,195 7/6/2016
2.9.0 9,132 7/20/2016
2.8.0 2,971 7/2/2016
2.7.4 1,876 6/24/2016
2.7.3.1 1,458 6/16/2016
2.7.3 2,063 6/6/2016
2.7.2 3,996 4/23/2016
2.7.1 2,210 4/9/2016
2.7.0 1,181 4/8/2016
2.6.2 1,428 4/2/2016
2.6.1 1,142 4/2/2016
2.6.0 1,422 3/24/2016
2.6.0-beta1 1,121 2/29/2016
2.5.0 5,443 2/7/2016
2.4.2 2,818 1/10/2016
2.4.1 2,092 12/25/2015
2.4.0 1,236 12/23/2015
2.4.0-pre3 1,145 12/23/2015
2.4.0-pre2 1,135 12/23/2015
2.4.0-pre1 1,146 12/22/2015
2.3.1 1,500 12/18/2015
2.3.0.1 1,819 12/4/2015
2.3.0 1,494 12/1/2015
2.3.0-pre4 1,180 11/27/2015
2.3.0-pre3 1,176 11/26/2015
2.3.0-pre2 1,185 11/26/2015
2.3.0-pre 1,182 11/25/2015
2.2.8.1-pre 1,079 11/24/2015
2.2.8 1,894 11/10/2015
2.2.7.1 1,694 10/26/2015
2.2.7 1,171 10/26/2015
2.2.6.1 1,517 10/12/2015
2.2.6 1,209 10/9/2015
2.2.5 2,360 10/1/2015
2.2.4 1,721 9/11/2015
2.2.3.1 2,225 8/28/2015
2.2.3 1,203 8/27/2015
2.2.2 1,766 7/20/2015
2.2.1 1,794 6/28/2015
2.2.0 2,691 4/24/2015
2.1.8.2 1,450 4/2/2015
2.1.8.1 1,398 3/16/2015
2.1.7 1,260 3/14/2015
2.1.6 1,170 3/14/2015
2.1.5 1,201 3/12/2015
2.1.3 1,196 3/10/2015
2.1.2 1,201 3/8/2015
2.1.1 1,183 3/7/2015
2.1.0 1,406 2/25/2015
2.0.1 1,354 2/23/2015
2.0.0 1,243 2/23/2015
2.0.0-pre8 1,194 2/23/2015
2.0.0-pre7 1,193 2/22/2015
2.0.0-pre6 1,173 2/22/2015
2.0.0-pre5 1,190 2/22/2015
2.0.0-pre4 1,103 2/22/2015
2.0.0-pre3 1,114 2/22/2015
2.0.0-pre2 3,170 2/18/2015
2.0.0-pre1 1,259 2/17/2015
1.2.1 1,288 2/21/2015
1.2.0 1,237 2/17/2015
1.1.2 3,019 2/8/2015
1.1.1.2 1,277 2/6/2015
1.1.1.1 2,023 10/19/2014
1.1.1 1,240 10/19/2014
1.1.0 1,481 10/13/2014
1.1.0-beta2 1,142 10/11/2014
1.1.0-beta1 1,137 10/11/2014
1.0.3.1 1,410 10/10/2014
1.0.3 1,441 10/9/2014
1.0.2.2 1,258 10/5/2014
1.0.2 1,319 9/27/2014
1.0.1.1 1,225 9/27/2014
1.0.1 1,259 9/27/2014
1.0.0.2 1,389 9/4/2014
1.0.0.1 1,254 9/4/2014
1.0.0 1,406 9/4/2014
0.4.5.1 1,682 6/3/2014
0.4.5 1,568 5/7/2014
0.4.5-beta3 1,135 5/6/2014
0.4.5-beta2 1,510 5/6/2014
0.4.5-beta1 1,117 5/6/2014
0.4.4.3 1,340 5/4/2014
0.4.4.2 1,379 5/3/2014
0.4.4.1 1,280 5/3/2014
0.4.4 1,268 5/3/2014
0.4.3.1 1,268 4/30/2014
0.4.2.1 1,739 4/12/2014
0.4.2 1,764 4/11/2014
0.4.2-beta5 1,620 4/11/2014
0.4.2-beta4 1,694 4/11/2014
0.4.2-beta3 1,201 4/4/2014
0.4.2-beta2 1,195 4/4/2014
0.4.2-beta1 1,183 4/1/2014
0.4.1 1,358 2/2/2014
0.4.0.1 1,244 12/31/2013
0.4.0-rc1 1,164 12/16/2013
0.3.2 3,090 11/24/2011
0.3.1 1,442 11/21/2011
0.3.0 1,436 11/20/2011
0.2.0 1,657 10/17/2011
0.1.0 1,551 10/6/2011