O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required