Use the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform.
- Xamarin.iOS
- Xamarin.Android
- Xamarin.Mac
- WPF
- Windows Forms
- Windows Phone 8
- Windows Store Apps
This library is organized into several high-level assemblies:
ReactiveUI - Core library that doesn't rely on any particular UI framework.
ReactiveObject, the base ViewModel object, as well asReactiveCollection, 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.
publicclassColorChooserThatDoesntLikeGreen:ReactiveObject{//// Declaring a read/write property//byte_Red;publicbyteRed{get{return_Red;}set{this.RaiseAndSetIfChanged(value);}}byte_Green;publicbyteGreen{get{return_Green;}set{this.RaiseAndSetIfChanged(value);}}byte_Blue;publicbyteBlue{get{return_Blue;}set{this.RaiseAndSetIfChanged(value);}}//// Declaring a Property that's based on an Observable// ObservableAsPropertyHelper<Color>_Color;publicColorColor{get{return_Color.Value;}}ReactiveCommandOkButton{get;protectedset;}publicColorChooserThatDoesntLikeGreen(){varfinalColor=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,out_Color);// When the finalColor has full green, the Ok button is disabledOkButton=newReactiveCommand(finalColor.Select(x =>x.Green!=255));}}For more information on how to use ReactiveUI, check out ReactiveUI.