Uno Platform Documentation

repository·master·Indexed 27 days ago

https://github.com/unoplatform/uno

An open-source developer platform for building single-codebase .NET applications that run natively on Web (WebAssembly), Desktop (Windows, macOS, Linux via Skia), Mobile (iOS, Android), and Embedded systems using the WinUI 3 API surface. Includes details on the Uno Platform Studio AI-native productivity suite, WinUI-aligned theming models, and cross-platform UI capabilities.

Tokens
227.2K
Snippets
412
Records
1.1K
Agent score
95%

What's inside Uno Platform

  1. Overview of Uno Platform Core Capabilities

    master

    Uno Platform is a cross-platform UI framework that allows developers to build pixel-perfect applications from a single C# and XAML codebase. It targets multiple platforms including:

    • Windows (Win32, UWP, WinUI 3)
    • WebAssembly (Browser-based)
    • iOS (iPhone and iPad)
    • Android (Phones and tablets)
    • macOS (Native Mac applications)
    • Linux (GTK-based applications)
    • Embedded devices (IoT and specialized hardware)

    Developers can leverage existing Microsoft technologies (C# and XAML) and utilize modern development patterns like MVVM or MVUX.

  2. Overview of WASM Advanced Accessibility Features

    master

    The WASM Advanced Accessibility feature extends the base Uno Platform WebAssembly accessibility layer to support complex UI patterns. Key capabilities include:

    • Virtualized List/Grid Support: Managing semantic DOM elements for large datasets using viewport-aware lifecycles.
    • Live Regions: Wiring live region events through AutomationPeer with two-tier rate limiting (100ms debounce and 500ms/200ms sustained throttle) to prevent announcement flooding.
    • Focus Management: Implementing bidirectional focus synchronization and modal focus trapping (focus cycling within the DOM).
    • Focus Recovery: Ensuring focus is maintained or restored correctly during UI changes.
    • WCAG 2.1 AA Compliance: Designed to meet accessibility standards via semantic DOM overlays in Skia-based rendering.
  3. Overview of the Uno Dev Server

    master

    The Dev Server is a local development companion that enables productive inner-loop features for Uno Platform development. It runs as a lightweight HTTP process and maintains a bidirectional channel between your IDE and the running application.

    Key Features:

    • Transport Layer: Exchanges development-time messages between the IDE and the app.
    • Hot Reload: Powers Hot Reload and Hot Design experiences by delivering C# code, XAML, and asset updates.
    • Automatic Operation: Starts automatically when Uno Platform packages are referenced in your project and NuGet restore is successful.
  4. Overview of Uno Platform Core Framework

    master

    Uno Platform is an open-source (Apache 2.0) framework for building single-codebase .NET applications using the WinUI 3 API surface. It allows you to write C# and XAML once and deploy to multiple platforms.

    Supported Platforms

    • Mobile: Native iOS and Android via .NET.
    • Web: WebAssembly (Wasm) using the .NET Runtime WebAssembly SDK.
    • Desktop: Windows (WinUI 3), macOS, and Linux using Skia for high-performance, hardware-accelerated rendering.
    • Embedded: Linux via Skia Desktop running directly to the Framebuffer.

    Key Capabilities

    • UI Controls: Access WinUI components, Windows Community Toolkit, Uno Toolkit, and .NET MAUI controls.
    • Theming: Support for Material, Fluent, and Cupertino styles.
    • State Management: Supports traditional MVVM or the modern, declarative MVUX approach.
    • Cross-Platform APIs: Access native device features like sensors and secure storage through a unified API set.
  5. Overview of WebAssembly Skia Accessibility Enhancement

    master

    The WebAssembly Skia accessibility enhancement improves Uno Platform's accessibility in the browser by mapping automation peer patterns to ARIA attributes. It creates a parallel semantic DOM tree that overlays the Skia canvas. To ensure keyboard support and screen reader compatibility, it uses native HTML input elements for interactive controls.

    Key technical details:

    • Language/Version: C# (.NET 9.0/10.0), TypeScript
    • Primary Dependencies: Uno.UI (automation peers, UIElement), Uno.UI.Runtime.Skia.WebAssembly.Browser (accessibility layer), and System.Runtime.InteropServices.JavaScript (JSImport/JSExport).
    • Performance: Semantic DOM updates are debounced by 100ms, and virtualization is handled via EffectiveViewport to ensure only visible items have semantic elements.
  6. Understand ListView implementation differences by platform

    master

    Uno Platform's ListView implementation varies significantly depending on the target platform. Understanding these differences is crucial for debugging layout or performance issues.

    Native Implementations (Android & iOS)

    On Android and iOS, ListView maps the XAML API to native list controls. This provides advanced features like item animations 'for free' but introduces platform-specific behaviors and complexity in the visual tree.

    • Android: Uses RecyclerView.
    • iOS: Uses UICollectionView.
    • Key Difference: The scrolling container is the NativeListViewBase itself, not a ScrollViewer. The ItemsPresenter is located outside the scrollable region.
    • Key Difference: ItemsStackPanel or ItemsWrapGrid are not present in the visual tree; they act as facades for the native layouter.

    Managed Implementation (WebAssembly, Skia, macOS)

    On these platforms, ListView uses a purely managed implementation that is closer to WinUI.

    • Items Panel: Uses a 'real' panel (like ItemsStackPanel) that hosts ListViewItems as children.
    • Scrolling: Uses a 'real' ScrollViewer from the control template to handle scrolling.
    • Note: The managed implementation is newer and may lack some features available in the Android/iOS or WinUI versions.
  7. Understand the solution structure for applications with tests

    master

    When creating an Uno application with testing enabled, the generated solution is organized into three primary projects:

    • MyProjectName: Contains the core application logic, view models, services, pages, controls, and UI views.
    • MyProjectName.Tests: Dedicated project for writing and running unit tests.
    • MyProjectName.UI.Tests: Dedicated project for writing and running UI tests (utilizing the Uno.UITest NuGet package).
  8. Understand the Uno DevServer Discovery Roadmap

    master

    The Uno DevServer is transitioning from a fragmented, MSBuild-dependent discovery model to a unified, manifest-based pipeline. This change aims to make DevServer startup faster, more resilient to broken solutions, and consistent across Visual Studio, VSCode, Rider, and the CLI.

    Key improvements in the roadmap include:

    • Manifest-based discovery: DevServer hosts and add-ins will be described by manifests embedded in NuGet packages, removing the need for MSBuild-driven discovery.
    • Unified CLI: A shared CLI providing disco, start, and diag commands will serve as the single entrypoint for all IDEs and manual command-line usage.
    • Local Add-in Injection: Support for injecting local add-ins via explicit manifests or directories.
    • Build-independent startup: Discovery will work even when the solution is in a broken state, as it will no longer rely on successful MSBuild execution.
  9. Understand Silverlight Authentication UI components

    master

    When migrating a Silverlight Business App, identify the following authentication UI components to plan your replacement:

    • LoginForm: Uses a Silverlight DataForm to render login fields.
    • RegistrationForm: Uses a Silverlight DataForm to render registration fields.
    • LoginRegistrationWindow: A ChildWindow that hosts either the LoginForm or RegistrationForm.
    • LoginStatus: A UserControl using VisualStateManager to toggle between three states:
      • Windows authentication (displays current user).
      • Login UI (displays a button to open the LoginRegistrationWindow).
      • Logout UI (displays a button to log out).

    Note: The TimeEntryRIA sample only utilizes the LoginForm.

  10. Develop cross-platform applications with Uno Platform

    master
    Uno Platform allows you to write applications once using XAML and/or C# and deploy them to multiple target platforms. It leverages the WinUI application API, meaning much of the development experience is aligned with Microsoft's WinUI documentation.
  11. Understand Uno Platform Status indicators

    master

    The Uno Platform Status provides real-time feedback on your development environment. Common statuses include:

    • Checking environment: Scanning the solution and active projects.
    • Waiting for NuGet restore: The IDE is waiting for NuGet packages to be restored before enabling Uno features.
    • Ready: All environment checks passed; you can start your app.
    • Warning or Error: Issues detected with actionable guidance provided in the status panel.

    Note on NuGet: The Uno tooling aligns with your solution's package versions. If NuGet restore fails or is still running, Uno features will remain disabled. Resolve restore errors first to allow the panel to update automatically.

  12. Understand the Uno.Sdk and Single Project structure

    master

    The Uno.Sdk abstracts the complexity of building cross-platform projects.

    Key Features:

    • Single Project Structure: Instead of multiple platform-specific projects, all code resides in one project. Platform-specific code is organized within a Platforms folder (e.g., Platforms/Android, Platforms/iOS, Platforms/WebAssembly).
    • Simplified Versioning: The Uno Platform core package versions are managed in a single location via global.json using the Uno.Sdk MSBuild SDK.
    • Default Platform Settings: Values like SupportedOSPlatformVersion are automatically set to the minimum supported by Uno Platform via the SDK, though these can be overridden in the .csproj using <Choose> and <When> blocks for specific target frameworks.