# ReactiveUI.Uno **Repository Path**: mirrors_reactiveui/ReactiveUI.Uno ## Basic Information - **Project Name**: ReactiveUI.Uno - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-12 - **Last Updated**: 2026-02-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Build](https://github.com/reactiveui/reactiveui.uno/actions/workflows/ci-build.yml/badge.svg)](https://github.com/reactiveui/reactiveui.uno/actions/workflows/ci-build.yml) [![Code Coverage](https://codecov.io/gh/reactiveui/reactiveui.uno/branch/main/graph/badge.svg)](https://codecov.io/gh/reactiveui/reactiveui.uno) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://reactiveui.net/contribute) [![](https://img.shields.io/badge/chat-slack-blue.svg)](https://reactiveui.net/slack) [![NuGet](https://img.shields.io/nuget/v/ReactiveUI.Uno.svg)](https://www.nuget.org/packages/ReactiveUI.Uno/)

# ReactiveUI for Uno Platform This package provides [ReactiveUI](https://reactiveui.net/) bindings for the [Uno Platform](https://platform.uno/), enabling you to build composable, cross-platform model-view-viewmodel (MVVM) applications that run on iOS, Android, WebAssembly, macOS, and Windows. --- ## NuGet Packages To get started, install the following package into your shared Uno Platform project. | Platform | NuGet | | ----------------- | ---------------------- | | Platform Uno | [![NuGet](https://img.shields.io/nuget/v/ReactiveUI.Uno.svg)](https://www.nuget.org/packages/ReactiveUI.Uno/) | ----- ## Tutorial: Mastering ReactiveUI with the Uno Platform Welcome to the `ReactiveUI.Uno` guide! This tutorial will walk you through setting up a cross-platform application using the Uno Platform with the power of ReactiveUI. We'll start from the basics and build up to a fully reactive application. `ReactiveUI.Uno` provides the necessary bindings and helpers to seamlessly integrate the ReactiveUI MVVM framework with your Uno Platform projects, enabling you to write elegant, testable, and maintainable code. ### Chapter 1: Getting Started - Your First Reactive View Let's begin by setting up your project and creating your first reactive view and view model. #### 1. Installation First, ensure you have the Uno Platform templates installed and create a new application. Then, add the `ReactiveUI.Uno` package to your project's shared `csproj` file. ```xml ``` #### 2. Initialization Next, initialize ReactiveUI in your `App.cs` startup code. This wires up the necessary services for the Uno Platform. ```csharp using ReactiveUI; using Splat; public App() { // ... existing initialization ... var builder = Splat.AppLocator.CurrentMutable.CreateReactiveUIBuilder(); builder .WithUno() // This extension method initializes ReactiveUI for Uno .Build(); // ... more initialization ... } ``` #### 3. Create a ViewModel Create a simple view model. Notice how it inherits from `ReactiveObject` and uses `RaiseAndSetIfChanged` to notify the UI of property changes. ```csharp // MyViewModel.cs using ReactiveUI; public class MyViewModel : ReactiveObject { private string _greeting; public string Greeting { get => _greeting; set => this.RaiseAndSetIfChanged(ref _greeting, value); } public MyViewModel() { Greeting = "Hello, Reactive World!"; } } ``` #### 4. Create a Reactive View Now, let's create a view that binds to this view model. `ReactivePage` is a base class that makes this easy. ```xml ``` In the code-behind, use `WhenActivated` to set up your bindings. This is the core of a reactive view. ```csharp // MainPage.xaml.cs using ReactiveUI; using System.Reactive.Disposables; public sealed partial class MainPage : ReactivePage { public MainPage() { this.InitializeComponent(); ViewModel = new MyViewModel(); this.WhenActivated(disposables => { // Bind the Greeting property of the ViewModel to the Text of the TextBlock this.OneWayBind(ViewModel, viewModel => viewModel.Greeting, view => view.GreetingTextBlock.Text) .DisposeWith(disposables); }); } } ``` Congratulations! You've just created your first reactive UI with `ReactiveUI.Uno`. When you run the app, you'll see the greeting message displayed. ### Chapter 2: Handling User Interaction with ReactiveCommands Static text is great, but apps need to respond to users. `ReactiveCommand` is the standard way to handle user actions like button clicks in a testable and composable way. #### 1. Add a Command to the ViewModel Let's add a command to our view model that generates a new greeting. ```csharp // MyViewModel.cs using ReactiveUI; using System; using System.Reactive; public class MyViewModel : ReactiveObject { // ... Greeting property from before ... public ReactiveCommand GenerateGreetingCommand { get; } public MyViewModel() { Greeting = "Hello, Reactive World!"; GenerateGreetingCommand = ReactiveCommand.Create(() => { Greeting = $"Hello from Uno! The time is {DateTime.Now.ToLongTimeString()}"; }); } } ``` #### 2. Bind the Command in the View Now, add a button to your XAML and bind its `Command` property to the new command. ```xml