Skip to content

Commit

Permalink
Bump version to v2.4.0, modify README.md with AdvancedImage.
Browse files Browse the repository at this point in the history
Close #2
  • Loading branch information
SKProCH committed Jul 19, 2022
1 parent 3cb9401 commit badc101
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
6 changes: 3 additions & 3 deletions AsyncImageLoader.Avalonia/AsyncImageLoader.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>AsyncImageLoader.Avalonia</Title>
<Authors>SKProCH</Authors>
<Description>Provides way to asynchronous bitmap loading from web for Avalonia Image control</Description>
<Description>Provides way to asynchronous bitmap loading from web for Avalonia Image control and more</Description>
<PackageProjectUrl>https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>image cross-platform avalonia avaloniaui c-sharp-library</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>2.3.0</Version>
<Version>2.4.0</Version>
<PackageReleaseNotes>
- Make ImageSource.SourceProperty nullable
- Add AdvancedImage control
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ dotnet add package AsyncImageLoader.Avalonia

## Using

Note: 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):
```xaml
<Window ...
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
...>
<!-- Your root element content -->
```
Note: Assets and resources in Avalonia described [here](https://docs.avaloniaui.net/docs/getting-started/assets).

### 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:
```xaml
Expand All @@ -27,20 +37,23 @@ Should turn into:
```xaml
<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.
Also you can use `ImageLoader.IsLoading` readonly attached property that indicates whether the load is in progress or not.

Note: 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):
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).

### 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:
```xaml
<Window ...
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
...>
<!-- Your root element content -->
<StyleInclude Source="avares://AsyncImageLoader.Avalonia/AdvancedImage.axaml" />
```

### About resources and assets
AsyncImageLoader **support** `resm:` and `avares:` links.
And does **not** support relative referenced assets such as `Source="icon.png"` or `Source="/icon.png"`. Here's an [issue](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/issues/2) that describes why.
Assets and resources in Avalonia described [here](https://docs.avaloniaui.net/docs/getting-started/assets).
And you can use `AdvancedImage` as any other control:
```xaml
<asyncImageLoader:AdvancedImage Width="150" Height="150" Source="../Assets/cat4.jpg" />
```
This control allows to specify a custom IAsyncImageLoader for particular control.
Also, this control has loading indicator support out of the box.

## Loaders
ImageLoader will use instance of [IImageLoader](https://github.com/AvaloniaUtils/AsyncImageLoader.Avalonia/blob/master/AsyncImageLoader.Avalonia/IAsyncImageLoader.cs) for serving your requests.
Expand Down

0 comments on commit badc101

Please sign in to comment.