Ursa UI Library

repository·main·Indexed 23 days ago

https://github.com/irihitech/ursa.avalonia

An enterprise-level UI library for building cross-platform applications using the Avalonia UI framework. It includes the Irihi.Ursa core package, a Semi Design-inspired theme via Irihi.Ursa.Themes.Semi, and extensions for Prism.Avalonia and ReactiveUI.Avalonia. Compatible with Avalonia versions 11.1.x through 11.3.x, excluding version 11.2.0.

Tokens
1.3K
Snippets
6
Records
12
Agent score
68%

What's inside Ursa

  1. Use the QrCode control

    main

    The QrCode control is a self-contained component included in Ursa.Avalonia to provide QR code rendering without requiring the full Avalonia.Labs dependency.

    Important Maintenance Note: This control is a local copy of the implementation from Avalonia.Labs. It may not receive the same updates or bug fixes as the upstream project. If you require the latest features or specific fixes from the upstream source, it is recommended to use the official Avalonia.Labs NuGet package instead of this local version.

  2. Ursa Extensions: Prism and ReactiveUI

    main

    Ursa provides specialized extensions for popular Avalonia frameworks:

    • Prism Extension: Use Irihi.Ursa.PrismExtension to integrate Ursa with Prism.Avalonia. This package provides dialog-related services that allow you to use Ursa dialogs in a Prism-idiomatic way.
    • ReactiveUI Extension: Use Irihi.Ursa.ReactiveUIExtension to integrate with ReactiveUI.Avalonia. This package provides ReactiveUI-compatible versions of UrsaWindow and UrsaView.
  3. Configure Ursa.Themes.Semi in Avalonia

    main

    After installing the packages, you must include the styles in your App.xaml (or the Application definition of your project). You need to define the semi namespace and add both SemiTheme and UrsaSemiTheme to the Application.Styles collection.

    <Application...
        xmlns:semi="https://irihi.tech/semi"
        ....>
    
        <Application.Styles>
            <semi:SemiTheme Locale="zh-CN" />
            <semi:UrsaSemiTheme Locale="zh-CN"/>
        </Application.Styles>
        ...
  4. Use Avalonia.Labs instead of the local QrCode control

    main

    If you prefer to use the official implementation from Avalonia.Labs rather than the local copy provided by Ursa, follow these steps:

    1. Add the Avalonia.Labs package to your project via NuGet.
    2. Remove the local QrCode control from your project to avoid naming conflicts or duplicate implementations.
  5. Install Ursa and Semi Theme

    main

    To use Ursa controls in your Avalonia application, you must install the core Ursa package and a compatible theme package. Ursa.Themes.Semi (inspired by Semi Design) is the recommended theme for Ursa controls.

    1. Install the core Ursa package.
    2. Install Semi.Avalonia and Irihi.Ursa.Themes.Semi to provide the visual styles.
    dotnet add package Irihi.Ursa
    dotnet add package Semi.Avalonia
    dotnet add package Irihi.Ursa.Themes.Semi
  6. Configure Ursa.Themes.Semi theme

    main

    Ursa controls require a theme package to render correctly. Ursa.Themes.Semi is a theme inspired by Semi Design.

    To set it up:

    1. Add the Semi.Avalonia and Irihi.Ursa.Themes.Semi NuGet packages.
    2. Include SemiTheme and UrsaSemiTheme in your App.axaml (or Application.Styles).
    dotnet add package Semi.Avalonia
    dotnet add package Irihi.Ursa.Themes.Semi
    <Application...
        xmlns:semi="https://irihi.tech/semi"
        ....>
    
        <Application.Styles>
            <semi:SemiTheme Locale="zh-CN" />
            <semi:UrsaSemiTheme Locale="zh-CN"/>
        </Application.Styles>
  7. Use Ursa controls in Avalonia

    main

    Once the library and themes are installed, you can use Ursa controls by declaring the https://irihi.tech/ursa XML namespace in your XAML files.

    <Window
        ...
        xmlns:u="https://irihi.tech/ursa"
        ...>
        <StackPanel Margin="20">
            <u:TagInput />
        </StackPanel>
    </Window>
  8. Use Ursa controls in XAML

    main

    To use Ursa controls in your windows or user controls, declare the Ursa namespace (typically using the prefix u) and then use the controls as standard Avalonia elements.

    <Window
        ...
        xmlns:u="https://irihi.tech/ursa"
        ...>
        <StackPanel Margin="20">
            <u:TagInput />
        </StackPanel>
    </Window>