GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - reactiveui/ReactiveUI.SourceGenerators: Roslyn source generators that write ReactiveUI boilerplate at compile time. Attributes such as [Reactive], [ObservableAsProperty], [ReactiveCommand] and [IViewFor] produce reactive properties, commands and view bindings without reflection or IL weaving.

BranchesTags
Open more actions menu

Latest commit

 

History

445 Commits
445 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
images
images
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
codecov.yml
codecov.yml
 
 
tests.runsettings
tests.runsettings
 
 

Repository files navigation

ReactiveUI

ReactiveUI.SourceGenerators

Compile-time code for ReactiveUI. No reflection. Trim and NativeAOT safe.

NuGet NuGet Build Coverage License Slack

Two families of Roslyn source generators that work together:

Attribute generators Binding generators
Package ReactiveUI.SourceGenerators ReactiveUI.Binding (and platform packages)
You write [Reactive], [ReactiveCommand], [IViewFor] WhenChanged, Bind, ToProperty, [ObservableAsProperty]
You get Properties, commands, views, collections Observations and bindings, with no expression trees
Guide Attribute generators Binding reference

Quick start

Attributes. Mark a field. The property, its change notification and the command are written for you.

public partial class LoginViewModel : ReactiveObject
{
    [Reactive] private string _userName = "";

    [ReactiveCommand]
    private void SignIn() { }
}

Binding. Name the path as a lambda. The generator writes the code that attaches to each link of it.

IObservable<string> city = viewModel.WhenChanged(x => x.Address.City);

view.OneWayBind(viewModel, x => x.UserName, v => v.NameLabel.Text);

Install

dotnet add package ReactiveUI.SourceGenerators   # attribute generators
dotnet add package ReactiveUI.Binding            # binding generators, no System.Reactive
dotnet add package ReactiveUI.Binding.Reactive   # binding generators on System.Reactive

Reference one binding runtime package, not both. Add PrivateAssets="all" to ReactiveUI.SourceGenerators.

Packages

Package Purpose
ReactiveUI.SourceGenerators Attribute generators
ReactiveUI.Binding, ReactiveUI.Binding.Reactive Binding runtime, generator and analyzer
ReactiveUI.Binding.Wpf, .WinForms, .Maui, .Avalonia, .Uno Platform property observation and view thread routing
*.Reactive platform packages The same, for System.Reactive apps

Requirements

Attribute generators Binding generators
Language C# 12 C# 7.3 for generated code; interceptors need C# 11
Compiler Roslyn 4.8 or later Roslyn 4.8 or later; interceptors need 4.13
Runtime .NET 8 to 11, .NET Framework 4.6.2 to 4.8.1 The same

Examples

Every example runs and prints what it does.

Example Shows
index Your first binding
observing WhenChanged, WhenAny, WhenAnyValue, WhenAnyObservable
bindings One-way, two-way, command and interaction bindings
properties ToProperty and [ObservableAsProperty]
converters Built-in type converters
custom-converters Writing your own converters
mechanisms How a property reports a change
views The view locator and IViewFor<T>
threading Which thread a binding writes on
xaml Controls named in MAUI and Avalonia XAML
sourcegenerators Binding to members the attribute generators write
unsafe Run-time expressions
setup Configuration, analyzer and NativeAOT
Execute The attribute generators in use
ToPropertyVerification ToProperty on every runtime target
PlatformBindingsVerification ToProperty feeding real WPF, WinForms and MAUI controls

Documentation

Topic Where
Attribute generators src/ReactiveUI.SourceGenerators
Binding reference: APIs, diagnostics, threading, differences from ReactiveUI docs/ReactiveUI.Binding.md
Benchmarks and current figures src/benchmarks
Contributing and repository layout CLAUDE.md
ReactiveUI handbook reactiveui.net

Core team


Chris Pulman

London, UK


Glenn Watson

Melbourne, Australia

Contribute

The project uses the MIT license. Everyone is welcome, including first-time contributors.

  • Answer questions on GitHub Discussions
  • Improve the docs where something is missing or unclear.
  • Contribute code. Read CLAUDE.md first.

Credits

Portions of this code are derived from PolySharp and the Microsoft MVVM Community Toolkit.

Sponsors

JetBrains supports ReactiveUI's maintainers through its open source programme. Anthropic supports them with Claude, and OpenAI with Codex.

JetBrains Claude by Anthropic OpenAI

See our sponsors. All names and logos belong to their owners.

About

Roslyn source generators that write ReactiveUI boilerplate at compile time. Attributes such as [Reactive], [ObservableAsProperty], [ReactiveCommand] and [IViewFor] produce reactive properties, commands and view bindings without reflection or IL weaving.

Topics

reactiveuisourcegenerator

Resources

Readme
License

Code of conduct

Code of conduct

Security policy

Security policy
Activity
Custom properties

Stars

70 stars

Watchers

7 watching

Forks

6 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.