AsyncImageLoader.Avalonia 3.2.1

dotnet add package AsyncImageLoader.Avalonia --version 3.2.1
NuGet\Install-Package AsyncImageLoader.Avalonia -Version 3.2.1
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="AsyncImageLoader.Avalonia" Version="3.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AsyncImageLoader.Avalonia --version 3.2.1
#r "nuget: AsyncImageLoader.Avalonia, 3.2.1"
#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 AsyncImageLoader.Avalonia as a Cake Addin
#addin nuget:?package=AsyncImageLoader.Avalonia&version=3.2.1

// Install AsyncImageLoader.Avalonia as a Cake Tool
#tool nuget:?package=AsyncImageLoader.Avalonia&version=3.2.1

AsyncImageLoader.Avalonia

Provides way to asynchronous bitmap loading for Avalonia Image control.
Features:

  • Supports urls and downloading from web
  • Asynchronous loading
  • Integrated inmemory cache
  • Integrated disk cache
  • Easy to implement your own way of images loading and caching

Getting started

  1. Install AsyncImageLoader.Avalonia nuget package
dotnet add package AsyncImageLoader.Avalonia
  1. Start using

Using

Note: The first time you will need to import the AsyncImageLoader namespace to your xaml file. Usually your IDE should suggest it automatically. The root element in the file will be like this:

<Window ...
        xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
        ...>
   

Note: Assets and resources in Avalonia described here.

ImageLoader attached property

The only thing you need to do in your xaml is to replace the Source property in Image with ImageLoader.Source.
For example, your old code:

<Image Source="https://mycoolwebsite.io/image.jpg" />

Should turn into:

<Image asyncImageLoader:ImageLoader.Source="https://mycoolwebsite.io/image.jpg" />

Also you can use ImageLoader.IsLoading readonly attached property that indicates whether the load is in progress or not.

AsyncImageLoader support resm: and avares: links. And does not support relative referenced assets such as Source="icon.png" or Source="/icon.png". Use AdvancedImage control.

AdvancedImage control

This control provides all capabilities of ImageLoader attached property and support relative referenced assets such as Source="icon.png" or Source="/icon.png". Before you go, add following style to you App.xaml file and Application.Styles section:

<StyleInclude Source="avares://AsyncImageLoader.Avalonia/AdvancedImage.axaml" />

And you can use AdvancedImage as any other control:

<asyncImageLoader:AdvancedImage Width="150" Height="150" Source="../Assets/cat4.jpg" />

This control allows specifying a custom IAsyncImageLoader for particular control.
Also, this control has loading indicator support out of the box.

ImageBrush

If you need a brush you can use Avalonia's ImageBrush with ImageBrushLoader.Source property (instead of default Source). It will look like that:

<Border>
  <Border.Background>
    <ImageBrush
      asyncImageLoader:ImageBrushLoader.Source="https://mycoolwebsite.io/image.jpg" />
  </Border.Background>
</Border>

Loaders

ImageLoader will use instance of IImageLoader for serving your requests.
You can change the loader used by setting new one to the ImageLoader.AsyncImageLoader property. Do not forget to Dispose previous loader.
There are several loaders available out of the box:

  • BaseWebImageLoader - Provides non cached way to asynchronously load images without caching. Can be used as base class for custom loaders you dont want caching in any way.
  • RamCachedWebImageLoader - This is inheritor if BaseWebImageLoader with in memory images caching. Can be used as base class for custom loaders you want only inmemory caching.
  • DiskCachedWebImageLoader - This is inheritor if RamCachedWebImageLoader with in memory caching and disk caching for downloaded from the internet images. Can be used as base class for custom loaders if you want disk caching out of the box.

RamCachedWebImageLoader are used by default.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AsyncImageLoader.Avalonia:

Package Downloads
Pwa.Stories

is similar like Instagram Stories

GitHub repositories (6)

Showing the top 5 popular GitHub repositories that depend on AsyncImageLoader.Avalonia:

Repository Stars
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
Artemis-RGB/Artemis
Provides advanced unified lighting across many different brands RGB peripherals
HeyM1ke/Assist
C# Valorant Thirdparty Launcher
dorisoy/Dorisoy.Pan
Dorisoy.Pan 是基于.net core8 的跨平台文档管理系统,使用 MS SQL 2012 / MySql8.0(或更高版本)后端数据库,您可以在 Windows、Linux 或 Mac 上运行它,项目中的所有方法都是异步的,支持令牌基身份验证,项目体系结构遵循著名的软件模式和最佳安全实践。源代码是完全可定制的,热插拔且清晰的体系结构,使开发定制功能和遵循任何业务需求变得容易。 系统使用最新的 Microsoft 技术,高性能稳定性和安全性
b-editor/beutl
クロスプラットフォームで動作する動画編集 (コンポジット) ソフトウェアです。
Version Downloads Last updated
3.2.1 11,539 9/26/2023
3.2.1-rc1 89 9/23/2023
3.2.0 2,602 8/8/2023
3.1.0 296 7/30/2023
3.0.0 673 7/17/2023
3.0.0-avalonia11-preview6 703 6/1/2023
3.0.0-avalonia11-preview5 133 5/27/2023
3.0.0-avalonia11-preview4 387 3/27/2023
3.0.0-avalonia11-preview3 567 2/6/2023
3.0.0-avalonia11-preview2 364 11/13/2022
3.0.0-avalonia11 1,401 8/23/2022
2.5.0 359 5/22/2023
2.4.0 3,965 7/19/2022
2.3.0 406 7/16/2022
2.2.0 601 6/18/2022
2.1.1 423 6/8/2022
2.1.0 426 11/13/2021
2.0.1 302 11/10/2021
2.0.0 277 11/10/2021
1.0.0 344 11/9/2021

- Fix ObjectDisposedException in Cancellation token access (#19)