A new MVVM + Reactive Extensions library - ReactiveXaml RRS feed

  • General discussion

  • Hey guys, I'd love your feedback on this library that I've been working on that combines MVVM ideas with Rx, and makes it drastically easier to write certain UI behaviors, and makes others that should be easy like handling jobs on other threads to be trivial - check it out on Github at:

    I've written a few blog posts about it and it has a sample project:


    From the Readme:

    This library is an exploration I've been working on for several weeks on combining WPF Model-View-ViewModel paradigm with the Reactive Extensions for .NET (Rx). Combining these two make managing concurrency as well as expressing complicated interactions between objects possible in a declarative, functional way.  

    ReactiveCommand - an implementation of ICommand that is also a Subject whose OnNext is raised when Execute is executed. Its CanExecute can also be defined by an IObservable which means the UI will instantly update instead of implementations which rely on RequerySuggested.

    ReactiveAsyncCommand - a derivative of ReactiveCommand that encapsulates the common pattern of "Fire asynchronous command, then marshal result back onto dispatcher thread". Allows you to set a maximum level of concurrency as well (i.e. "I only want 3 inflight requests" - when the maximum is reached, CanExecute returns false).

    ReactiveObject - a ViewModel object based on Josh Smith's implementation, that also implements IObservable as a way to notify property changes. It also allows a straightforward way to observe the changes of a single property.

    ReactiveValidatedObject - a derivative of ReactiveObject that is validated via DataAnnotations by implementing IDataErrorInfo, so properties can be annotated with their restrictions and the UI will automatically reflect the errors.

    ObservableAsPropertyHelper<T> - a class that easily lets you convert an IObservable into a property that stores its latest value, as well as fires NotifyPropertyChanged when the property changes. This is really useful for combining existing properties together and replacing IValueConverters, since your ViewModels will also be IObservables.

    AsyncCommandVisualStateBehavior - this behavior will watch a ReactiveAsyncCommand and transition its target to different states based on the command's status - for example, displaying a Spinner while a command is running.

    FollowObservableStateBehavior - this behavior will use the output of an IObservable and call VisualStateManager.GoToState on its target; using Observable.Merge makes it fairly straightforward to build a state machine based on the changes in the ViewModel.

    ObservableTrigger - this trigger will fire when an IObservable calls OnNext and can be tied to any arbitrary Expression Action.
    Friday, July 2, 2010 4:30 AM