Prism.DryIoc.Avalonia 9.0.401.11000-pre

This is a prerelease version of Prism.DryIoc.Avalonia.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Prism.DryIoc.Avalonia --version 9.0.401.11000-pre                
NuGet\Install-Package Prism.DryIoc.Avalonia -Version 9.0.401.11000-pre                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prism.DryIoc.Avalonia" Version="9.0.401.11000-pre" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prism.DryIoc.Avalonia --version 9.0.401.11000-pre                
#r "nuget: Prism.DryIoc.Avalonia, 9.0.401.11000-pre"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Prism.DryIoc.Avalonia as a Cake Addin
#addin nuget:?package=Prism.DryIoc.Avalonia&version=9.0.401.11000-pre&prerelease

// Install Prism.DryIoc.Avalonia as a Cake Tool
#tool nuget:?package=Prism.DryIoc.Avalonia&version=9.0.401.11000-pre&prerelease                

Prism.Avalonia

Prism.Avalonia provides your Avalonia apps with Prism framework support so you can Navigate, create Dialog Windows and Notifications, provide Dependency Injection and internal Messaging easier than before! You will need both packages installed to get started.

Announcement:

Prism.Avalonia v9.0 beta coming soon!

For more samples outside of this repo, check out:

Sample Outlookish

With Prism.Avalonia's logic and development approach being similar to that of Prism for WPF, so you can get started right away! Keep in mind, they are similar and not 1-to-1. Check out our Wiki and Avalonia Outlookish app for tips and tricks.

Package Releases

Just like Prism.WPF or Prism.Maui, your project must reference both the Prism.Avalonia (Core) and Prism.DryIoc.Avalonia (IoC container) packages to work.

Package Stable Preview
Prism.Avalonia Prism.Avalonia NuGet Badge Prism.Avalonia NuGet Badge
Prism.DryIoc.Avalonia Prism.DryIoc.Avalonia NuGet Badge Prism.DryIoc.Avalonia NuGet Badge

Version Notice

Choose the NuGet package version that matches your Avalonia version.

The Avalonia version of this package uses SemVer format: MAJOR.MINOR.PATCH.REVISION. The REVISION segment indicates the Avalonia version support. For instance v8.1.97.11000 of this library supports, Avalonia v11.0.0.

major[.minor[.build[.revision]]] Assembly Version Attribute is limited to a ushort (65535) - Ref.

Avalonia Version NuGet Package
11.0 8.1.97.11000 (Core) (DryIoc)
0.10.21 8.1.97.1021 (Core) (DryIoc)
11.0 RC-1.1 8.1.97.11000-rc1.1 (Core) (DryIoc)
11.0 Preview 8 8.1.97.11-preview.11.8
11.0 Preview 5 8.1.97.4-preview.11.5
11.0 Preview 4 8.1.97.3-preview.11.4

Be sure to check out the ChangeLog.md and Upgrading-to-Avalonia-11.md when upgrading your NuGet packages. Also, view the official Avalonia Upgrading from v0.10.

Contributing

Prism.Avalonia is an open-source project under the MIT license. We encourage community members like yourself to contribute.

You can contribute today by creating a feature request, issue, or discussion on the forum. From there we can have a brief discussion as to where this fits into the backlog priority. If this is something that fits within the Prism architecture, we'll kindly ask you to create a Pull Request. Any PR made without first having an issue/discussion may be closed.

Issues posted without a description may be closed immediately. Use the discussion boards if you have a question, not Issues.

Install

Add the Prism.Avalonia and its DryIoc packages to your project:

# Avalonia v11
Install-Package Prism.Avalonia -Version 8.1.97.11000
Install-Package Prism.DryIoc.Avalonia -Version 8.1.97.11000

# Avalonia v0.10.1021
Install-Package Prism.Avalonia -Version 8.1.97.1021
Install-Package Prism.DryIoc.Avalonia -Version 8.1.97.1021

How to use

App.xaml.cs

public class App : PrismApplication
{
    public static bool IsSingleViewLifetime =>
        Environment.GetCommandLineArgs()
            .Any(a => a == "--fbdev" || a == "--drm");

    public static AppBuilder BuildAvaloniaApp() =>
        AppBuilder
            .Configure<App>()
            .UsePlatformDetect();

    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);
        base.Initialize();              // <-- Required
    }

    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
        // Register Services
        containerRegistry.Register<IRestService, RestService>();

        // Views - Generic
        containerRegistry.Register<MainWindow>();

        // Views - Region Navigation
        containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>();
        containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
        containerRegistry.RegisterForNavigation<SidebarView, SidebarViewModel>();
    }

    protected override AvaloniaObject CreateShell()
    {
        if (IsSingleViewLifetime)
            return Container.Resolve<MainControl>(); // For Linux Framebuffer or DRM
        else
            return Container.Resolve<MainWindow>();
    }

    protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
    {
        // Register modules
        moduleCatalog.AddModule<Module1.Module>();
        moduleCatalog.AddModule<Module2.Module>();
        moduleCatalog.AddModule<Module3.Module>();
    }

    /// <summary>Called after <seealso cref="Initialize"/>.</summary>
    protected override void OnInitialized()
    {
      // Register initial Views to Region.
      var regionManager = Container.Resolve<IRegionManager>();
      regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView));
      regionManager.RegisterViewWithRegion(RegionNames.SidebarRegion, typeof(SidebarView));
    }
}

Program.cs

Your default Avalonia Program.cs file does not need to be modified. Below is provided as a sample.

public static class Program
{
    public static AppBuilder BuildAvaloniaApp() =>
        AppBuilder.Configure<App>()
            .UsePlatformDetect()
            .With(new X11PlatformOptions
            {
                EnableMultiTouch = true,
                UseDBusMenu = true
            })
            .With(new Win32PlatformOptions())
            .UseSkia()
            .UseReactiveUI()
            .UseManagedSystemDialogs();

    static int Main(string[] args)
    {
        double GetScaling()
        {
            var idx = Array.IndexOf(args, "--scaling");
            if (idx != 0 && args.Length > idx + 1 &&
                double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling))
                return scaling;
            return 1;
        }

        var builder = BuildAvaloniaApp();
        InitializeLogging();
        if (args.Contains("--fbdev"))
        {
            SilenceConsole();
            return builder.StartLinuxFbDev(args, scaling: GetScaling());
        }
        else if (args.Contains("--drm"))
        {
            SilenceConsole();
            return builder.StartLinuxDrm(args, scaling: GetScaling());
        }
        else
            return builder.StartWithClassicDesktopLifetime(args);
    }

    static void SilenceConsole()
    {
        new Thread(() =>
        {
            Console.CursorVisible = false;
            while (true)
                Console.ReadKey(true);
        })
        { IsBackground = true }.Start();
    }
}

Branching Strategy

Below is a basic branching hierarchy and strategy.

Branch Purpose
master All releases are tagged published using the master branch
develop The default & active development branch. When a feature set is completed and ready for public release, the develop branch will be merged into master and a new NuGet package will be published.
feature/* New feature branch. Once completed, it is merged into develop and the branch must be deleted.
stable/* Stable release base build which shares cherry-picked merges from develop. This branch must not be deleted.

Sponsored by: Suess Labs a subsidary of Xeno Innovations, Inc.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Prism.DryIoc.Avalonia:

Package Downloads
OneWare.Essentials

Essentials Needed for One Ware Plugin Development

Abdrakov.Container.AvaloniaPrismAdapter

A lightweight container with adapter for Prism.Avalonia

Abdrakov.Solutions.Avalonia

A powerful base for Mvvm apps with Prism

I18N.Avalonia.Prism

Avalonia Prism Internationalization module

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Prism.DryIoc.Avalonia:

Repository Stars
yaobiao131/downkyicore
哔哩下载姬(跨平台版)downkyi,哔哩哔哩网站视频下载工具,支持批量下载,支持8K、HDR、杜比视界,提供工具箱(音视频提取、去水印等)。
irihitech/Ursa.Avalonia
Ursa is a UI library for building cross-platform UIs with Avalonia UI.
Version Downloads Last updated
9.0.401.11110-pre 604 8/4/2024
9.0.401.11074-pre 110 7/26/2024
9.0.401.11000-pre 282 4/28/2024
9.0.271.11074-pre 162 4/13/2024
8.1.97.11073 5,177 4/28/2024
8.1.97.11072 6,709 1/27/2024
8.1.97.11000 6,515 7/5/2023
8.1.97.11000-rc1.1 788 6/2/2023
8.1.97.1021 1,091 6/1/2023
8.1.97.11-preview.11.8 116 5/31/2023
8.1.97.4-preview.11.5 492 2/8/2023
8.1.97.3-preview.11.4 138 2/4/2023
8.1.97.2 1,395 12/9/2022
8.1.97.1 327 12/9/2022
8.1.97 1,609 7/18/2022
7.2.0.1430 3,791 1/28/2021
7.2.0.1429 600 9/26/2020
7.2.0.1428 868 4/14/2020
7.2.0.1427 620 2/11/2020
7.2.0.1426 616 1/31/2020
7.2.0.1425 536 1/30/2020
7.2.0.1424 624 12/30/2019
7.2.0.1423 591 12/18/2019
7.2.0.1422 811 11/26/2019
7.2.0.1367 1,095 9/3/2019
7.1.0.431 732 6/25/2019

* Added .NET 8 support
     * Upgraded to support Avalonia v11.0.7
     * Removed unused CommonServiceLocator