Implementing ViewModels with ReactiveObject

Like any other MVVM framework, ReactiveUI has an object designed as a ViewModel class. This object is based on traditional ViewModel object implementations in other MVVM frameworks, such as MVVM Foundation or Caliburn Micro. The critical difference is that it is easy to subscribe to changes via the “Changed” IObservable. While this provides notifications for any property that has changed, clients are often only interested in one or two changed properties. Fortunately, there is an easy way to retrieve these properties—via the WhenAny extension method, as follows:

var newLoginVm = new NewUserLoginViewModel(); newLoginVm.WhenAny(x => x.User, x => x.Value)     .Where(x => x.Name == "Bob")     .Subscribe(x ...

Get Programming Reactive Extensions and LINQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.