ReactiveProperty v7.4.0 is out

1 minute read

I haven’t written an article about 7.3, so I’ll write what was added in 7.3 and 7.4 here.

ToReactivePropertySlimAsSynchronized extension method (added in 7.3)

Added a ToReactivePropertySlimAsSynchronized extension method that generates a ReactivePropertySlim <T> that synchronizes with the properties of the class that implements the ʻINotifyPropertyChanged` interface.

It looks like the following. Same as ToReactivePropertyAsSynchronized except for the scheduler setting and the absence of ignoreValidationErrorValue.

var p = new Person { Name = "hoge" };
var rp = p.ToReactivePropertySlimAsSynchronized(x => x.Name);

ReactivePropertyScheduler.SetDefaultSchedulerFactory method (added in 7.4)

Until now, there were only two ways to specify an instance of ʻIScheduler` that ReactiveProperty and ReactiveCollection use to dispatch events.

–Set globally with ReactivePropertyScheduler.SetDefault (...)
–Explicitly specified in the scheduler argument of the constructor or factory method

The ReactivePropertyScheduler.SetDefaultSchedulerFactory added this time allows you to specify the process to generate ʻIScheduler` when the ReactiveProperty or ReactiveCollection is generated. So, in WPF, if you set the following in the Startup event of the App class, you can dispatch the event using Dispatcher at the time of instantiation.

private void Application_Startup(object sender, StartupEventArgs e)
    ReactivePropertyScheduler.SetDefaultSchedulerFactory(() =>
        new DispatcherScheduler(Dispatcher.CurrentDispatcher));

If it is assumed that ViewModel etc. will always be created on the UI thread to which you are associated, I think that this method will work even if there are multiple UI threads.

Personally, I recommend that you do not create multiple UI threads with WPF if you do not have to do it, but until now it was rather clogged with ReactiveProperty, but I made it usable for the time being It’s like that.


GitHub Actions has also been organized, so manual work has been reduced considerably, making it easier to release and update documents.