GithubHelp home page GithubHelp logo

discriminant / reactiveui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reactiveui/reactiveui

0.0 1.0 0.0 48.25 MB

An MVVM framework for .NET that integrates the Reactive Extensions (Rx) framework

Home Page: http://www.reactiveui.net

License: Microsoft Public License

reactiveui's Introduction

ReactiveUI

Use the Reactive Extensions for .NET along with Silverlight, WPF, or Windows Phone to create elegant, testable User Interfaces.

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 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(value); }
  }

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

  byte _Blue;
  public byte Blue {
    get { return _Blue; }
    set { this.RaiseAndSetIfChanged(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.

reactiveui's People

Contributors

anaisbetts avatar arturire avatar bsiegel avatar casnap avatar chrisbednarski avatar chrisway avatar dahlbyk avatar dchaib avatar distantcam avatar haacked avatar jimitndiaye avatar jlaanstra avatar johnstov avatar jordansjones avatar kentcb avatar lucasmaloney avatar merickowa avatar niik avatar robhorvath avatar shiftbot avatar shishkin avatar sillyotter avatar slodge avatar stanislawswierc avatar swsnr avatar tclem avatar terenced avatar waynemunro avatar wbardzinski avatar wendazhou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.