{"id":14965125,"url":"https://github.com/avaloniautils/asyncimageloader.avalonia","last_synced_at":"2025-04-04T19:10:57.847Z","repository":{"id":44809838,"uuid":"426253721","full_name":"AvaloniaUtils/AsyncImageLoader.Avalonia","owner":"AvaloniaUtils","description":"Provides way to asynchronous bitmap loading from web for Avalonia Image control and more","archived":false,"fork":false,"pushed_at":"2024-08-17T14:46:24.000Z","size":1417,"stargazers_count":154,"open_issues_count":1,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T01:02:38.708Z","etag":null,"topics":["avalonia","avaloniaui","c-sharp-library","cross-platform","image"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AvaloniaUtils.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-09T14:08:26.000Z","updated_at":"2024-10-18T08:45:58.000Z","dependencies_parsed_at":"2024-01-13T11:57:59.449Z","dependency_job_id":"5041d836-5018-4558-8fe4-53595f558aaa","html_url":"https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia","commit_stats":{"total_commits":61,"total_committers":7,"mean_commits":8.714285714285714,"dds":"0.19672131147540983","last_synced_commit":"58361205ea5c8582a3799ef6f76ce0bebc8f033b"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AvaloniaUtils%2FAsyncImageLoader.Avalonia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AvaloniaUtils%2FAsyncImageLoader.Avalonia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AvaloniaUtils%2FAsyncImageLoader.Avalonia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AvaloniaUtils%2FAsyncImageLoader.Avalonia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AvaloniaUtils","download_url":"https://codeload.github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avalonia","avaloniaui","c-sharp-library","cross-platform","image"],"created_at":"2024-09-24T13:34:15.560Z","updated_at":"2025-04-04T19:10:57.826Z","avatar_url":"https://github.com/AvaloniaUtils.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AsyncImageLoader.Avalonia\n\nProvides way to asynchronous bitmap loading for Avalonia Image control.  \nFeatures:\n- Supports urls and downloading from web\n- Asynchronous loading\n- Integrated inmemory cache\n- Integrated disk cache\n- Easy to implement your own way of images loading and caching\n\n## Getting started\n\n1. Install `AsyncImageLoader.Avalonia` [nuget package](https://www.nuget.org/packages/AsyncImageLoader.Avalonia/)\n```\ndotnet add package AsyncImageLoader.Avalonia\n```\n2. Start using\n\n## Using\n\nNote: The first time you will need to import the AsyncImageLoader namespace to your xaml file. Usually your IDE should [suggest it automatically](https://user-images.githubusercontent.com/29896317/140953397-00028365-5b93-4e6c-b470-094a555870c8.png). The root element in the file will be [like this](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia.Demo/Views/MainWindow.axaml#L6):\n```xaml\n\u003cWindow ...\n        xmlns:asyncImageLoader=\"clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia\"\n        ...\u003e\n   \u003c!-- Your root element content --\u003e\n```\nNote: Assets and resources in Avalonia described [here](https://docs.avaloniaui.net/docs/getting-started/assets).\n\n### ImageLoader attached property\nThe only thing you need to do in your xaml is to replace the `Source` property in `Image` with `ImageLoader.Source`.  \nFor example, your old code:  \n```xaml\n\u003cImage Source=\"https://mycoolwebsite.io/image.jpg\" /\u003e\n``` \nShould turn into:\n```xaml\n\u003cImage asyncImageLoader:ImageLoader.Source=\"https://mycoolwebsite.io/image.jpg\" /\u003e\n```\nAlso you can use `ImageLoader.IsLoading` readonly attached property that indicates whether the load is in progress or not.\n\nAsyncImageLoader **support** `resm:` and `avares:` links.\nAnd does **not** support relative referenced assets such as `Source=\"icon.png\"` or `Source=\"/icon.png\"`. Use [AdvancedImage control](#advancedimage-control).\n\n### AdvancedImage control\nThis control provides all capabilities of ImageLoader attached property and **support** relative referenced assets such as `Source=\"icon.png\"` or `Source=\"/icon.png\"`.\nBefore you go, add following style to you `App.xaml` file and `Application.Styles` section:\n```xaml\n\u003cStyleInclude Source=\"avares://AsyncImageLoader.Avalonia/AdvancedImage.axaml\" /\u003e\n```\nAnd you can use `AdvancedImage` as any other control:\n```xaml\n\u003casyncImageLoader:AdvancedImage Width=\"150\" Height=\"150\" Source=\"../Assets/cat4.jpg\" /\u003e\n```\nThis control allows specifying a custom IAsyncImageLoader for particular control.  \nAlso, this control has loading indicator support out of the box.\n\n### ImageBrush\nIf you need a brush you can use Avalonia's `ImageBrush` with `ImageBrushLoader.Source` property (instead of default `Source`). It will look like that:\n```xaml\n\u003cBorder\u003e\n  \u003cBorder.Background\u003e\n    \u003cImageBrush\n      asyncImageLoader:ImageBrushLoader.Source=\"https://mycoolwebsite.io/image.jpg\" /\u003e\n  \u003c/Border.Background\u003e\n\u003c/Border\u003e\n```\n\n## Loaders\nImageLoader will use instance of [IImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/IAsyncImageLoader.cs) for serving your requests.  \nYou can change the loader used by setting new one to the [ImageLoader.AsyncImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/ImageLoader.cs#L10) property. Do not forget to Dispose previous loader.  \nThere are several loaders available out of the box: \n- [BaseWebImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/Loaders/BaseCachedWebImageLoader.cs) - 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.\n- [RamCachedWebImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/Loaders/RamCachedWebImageLoader.cs) - This is inheritor if BaseWebImageLoader with in memory images caching. Can be used as base class for custom loaders you want only inmemory caching.\n- [DiskCachedWebImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/Loaders/DiskCachedWebImageLoader.cs) - 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.\n\n`RamCachedWebImageLoader` are used by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaloniautils%2Fasyncimageloader.avalonia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favaloniautils%2Fasyncimageloader.avalonia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favaloniautils%2Fasyncimageloader.avalonia/lists"}