Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An MVVM framework for .NET that integrates the Reactive Extensions (Rx) framework
C# Other
Pull request Compare This branch is 1 commit ahead, 2518 commits behind reactiveui:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
PerfConsoleRunner
ReactiveUI.Blend
ReactiveUI.Gtk
ReactiveUI.Routing.Tests
ReactiveUI.Routing
ReactiveUI.Sample.WP7
ReactiveUI.Sample
ReactiveUI.Serialization.Esent
ReactiveUI.Serialization.Tests
ReactiveUI.Serialization
ReactiveUI.Testing
ReactiveUI.Tests
ReactiveUI.Xaml
ReactiveUI
ext
packages
.gitignore
COPYING
Local.testsettings
MakeRelease.ps1
PerfConsoleRunner.psess
README.md
Rakefile
ReactiveUI.sln
ReactiveUI.sln.DotSettings
ReactiveUI.vsmdi
ReactiveUI_Mono.sln
ReactiveUI_Net4Only.sln
ReactiveUI_Net4Only.sln.DotSettings
ReactiveUI_SL5.sln
ReactiveUI_WP7.sln
ReactiveUI_WinRT.sln
ReactiveUI_iOS.sln
TraceAndTestImpact.testsettings
nuget.config

README.md

ReactiveUI

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.

This library is organized into several high-level assembly:

  • ReactiveUI - Core library that doesn't rely on any particular UI framework. ReactiveObject, the base ViewModel object, as well as ReactiveCollection, a more awesome ObservableCollection, is in here.

  • ReactiveUI.Xaml - Classes that require references to a Xaml'ly framework, like WPF or WinRT. ReactiveCommand, an implementation of ICommand, as well as the UserError classes are in this assembly.

  • ReactiveUI.Blend - This class has several Blend Behaviors and Triggers that make attaching ViewModel changes to Visual State Manager states.

  • ReactiveUI.Routing - A screens and navigation framework as well as ViewModel locator. This framework helps you to write applications using IoC containers to locate views, as well as navigating back and forwards between views.

A compelling example

public class ColorChooserThatDoesntLikeGreen : ReactiveObject
{
  //
  // Declaring a read/write property
  //

  byte _Red;
  public byte Red {
    get { return _Red; }
    set { this.RaiseAndSetIfChanged(x => x.Red, value); }
  }

  byte _Green;
  public byte Green {
    get { return _Green; }
    set { this.RaiseAndSetIfChanged(x => x.Green, value); }
  }

  byte _Blue;
  public byte Blue {
    get { return _Blue; }
    set { this.RaiseAndSetIfChanged(x => x.Blue, value); }
  }

  //
  // Declaring a Property that's based on an Observable
  // 

  ObservableAsPropertyHelper<Color> _Color;
  public Color Color {
    get { return _Color.Value; }
  }

  ReactiveCommand OkButton { get; protected set; }

  public ColorChooserThatDoesntLikeGreen()
  {
    var finalColor = this.WhenAny(x => x.Red, x => x.Green, x => x.Blue, 
        (r,g,b) => Color.FromRGB(r.Value, g.Value, b.Value));

    finalColor.ToProperty(this, x => x.Color);

    // When the finalColor has full green, the Ok button is disabled
    OkButton = new ReactiveCommand(finalColor.Select(x => x.Green != 255));
  }
}

Learn more

For more information on how to use ReactiveUI, check out ReactiveUI.

Something went wrong with that request. Please try again.