Projektanker.Icons.Avalonia
3.2.0
See the version list below for details.
dotnet add package Projektanker.Icons.Avalonia --version 3.2.0
NuGet\Install-Package Projektanker.Icons.Avalonia -Version 3.2.0
<PackageReference Include="Projektanker.Icons.Avalonia" Version="3.2.0" />
paket add Projektanker.Icons.Avalonia --version 3.2.0
#r "nuget: Projektanker.Icons.Avalonia, 3.2.0"
// Install Projektanker.Icons.Avalonia as a Cake Addin #addin nuget:?package=Projektanker.Icons.Avalonia&version=3.2.0 // Install Projektanker.Icons.Avalonia as a Cake Tool #tool nuget:?package=Projektanker.Icons.Avalonia&version=3.2.0
Icons.Avalonia
A library to easily display icons in an Avalonia App.
NuGet
Name | Description | Version |
---|---|---|
Projektanker.Icons.Avalonia | Core library | |
Projektanker.Icons.Avalonia.FontAwesome | Font Awesome Free | |
Projektanker.Icons.Avalonia.MaterialDesign | Material Design Icons |
Icon providers
Name | Prefix | Example |
---|---|---|
FontAwesome | fa |
fa-github |
MaterialDesign | mdi |
mdi-github |
Usage
A full example is available in the demo directory.
1. Register icon providers on app start up
Use the AppBuilder.AfterSetup
method to register a callback. Within this callback register the icon prodider(s). Otherwise the visual designer won't be able to use the registered icon provider(s).
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
public static void Main(string[] args)
{
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
{
return AppBuilder.Configure<App>()
.AfterSetup(AfterSetupCallback)
.UsePlatformDetect()
.LogToTrace();
}
// Called after setup
private static void AfterSetupCallback(AppBuilder appBuilder)
{
// Register icon provider(s)
IconProvider.Register<FontAwesomeIconProvider>();
IconProvider.Register<MaterialDesignIconProvider>();
}
}
2. Add xml namespace
Add xmlns:i="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
to your view.
3. Use the icon
Example: The GitHub icon.
FontAwesome
<i class="fab fa-github"></i>
Standalone
<i:Icon Value="fab fa-github" />
Attached
<Button i:Attached.Icon="fab fa-github" />
Done
Screenshot
Implement your own Icon Provider
Just implement the IIconProvider
interface:
namespace Projektanker.Icons.Avalonia
{
/// <summary>
/// Represents an icon provider.
/// </summary>
public interface IIconProvider
{
/// <summary>
/// Gets the prefix of the <see cref="IIconProvider"/>.
/// </summary>
string Prefix { get; }
/// <summary>
/// Gets the SVG path of the requested icon using the registered icon providers.
/// </summary>
/// <param name="value">The value specifying the icon to return it's path from.</param>
/// <returns>The path of the icon.</returns>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">The icon associated
/// with the specified <paramref name="value"/> does not exists.</exception>
string GetIconPath(string value);
}
}
and register it with the IconProvider
:
IconProvider.Register<MyCustomIconProvider>()
or
IIconProvider provider = new MyCustomIconProvider(/* custom ctor arguments */);
IconProvider.Register(provider);
The IIconProvider.Prefix
property have to be unique within all registered providers. It is used to select the right provider. E.g. FontAwesomeIconProvider
's prefix is fa
.
Product | Versions 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 was computed. |
.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. |
-
.NETStandard 2.0
- Avalonia.Desktop (>= 0.10.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Projektanker.Icons.Avalonia:
Package | Downloads |
---|---|
Projektanker.Icons.Avalonia.FontAwesome
A library to easily display FontAwesome icons in an Avalonia App. |
|
Projektanker.Icons.Avalonia.MaterialDesign
A library to easily display Material Design icons in an Avalonia App. |
|
MenuFactory
Simple Avalonia library to help manage the application menu |
GitHub repositories (11)
Showing the top 5 popular GitHub repositories that depend on Projektanker.Icons.Avalonia:
Repository | Stars |
---|---|
GreemDev/Ryujinx
Experimental Switch emulator written in C#
|
|
sn4k3/UVtools
MSLA/DLP, file analysis, calibration, repair, conversion and manipulation
|
|
aloneguid/parquet-dotnet
Fully managed Apache Parquet implementation
|
|
fifty-six/Scarab
An installer for Hollow Knight mods written in Avalonia.
|
|
BAndysc/WoWDatabaseEditor
Integrated development environment (IDE), an editor for Smart Scripts (SAI/smart_scripts) for TrinityCore based servers. Cmangos support work in progress. Featuring a 3D view built with OpenGL and custom ECS framework
|
Version | Downloads | Last updated | |
---|---|---|---|
9.5.0 | 68 | 11/24/2024 | |
9.4.3 | 756 | 11/18/2024 | |
9.4.2 | 122 | 11/18/2024 | |
9.4.1 | 4,691 | 10/4/2024 | |
9.4.0 | 23,383 | 7/21/2024 | |
9.3.0 | 27,549 | 4/7/2024 | |
9.2.0 | 1,040 | 3/29/2024 | |
9.1.2 | 6,556 | 3/12/2024 | |
9.1.1 | 6,253 | 2/22/2024 | |
9.0.1 | 10,982 | 12/8/2023 | |
9.0.0 | 667 | 12/6/2023 | |
8.4.0 | 2,373 | 12/6/2023 | |
8.3.0 | 9,440 | 10/11/2023 | |
8.2.0 | 4,873 | 8/6/2023 | |
8.1.0 | 1,066 | 7/26/2023 | |
8.0.0 | 1,264 | 7/17/2023 | |
7.0.1 | 1,171 | 7/16/2023 | |
7.0.0 | 685 | 7/16/2023 | |
6.6.0 | 1,837 | 7/10/2023 | |
6.6.0-rc1.1 | 5,834 | 6/7/2023 | |
6.6.0-preview6 | 1,050 | 4/26/2023 | |
6.5.0-preview6 | 1,549 | 3/24/2023 | |
6.5.0-preview5 | 1,208 | 2/28/2023 | |
6.4.0-preview5 | 771 | 2/4/2023 | |
6.3.0-preview4 | 1,823 | 12/12/2022 | |
6.2.0-preview1 | 793 | 9/21/2022 | |
6.1.0-preview1 | 573 | 8/29/2022 | |
6.0.0-preview1 | 595 | 8/24/2022 | |
5.13.0 | 4,532 | 4/26/2023 | |
5.12.0 | 1,493 | 4/2/2023 | |
5.11.0 | 1,070 | 3/26/2023 | |
5.10.0 | 1,516 | 2/28/2023 | |
5.9.0 | 1,826 | 2/12/2023 | |
5.8.0 | 2,229 | 12/12/2022 | |
5.7.0 | 1,056 | 12/12/2022 | |
5.6.0 | 3,216 | 11/20/2022 | |
5.5.0 | 11,936 | 9/4/2022 | |
5.4.0 | 1,435 | 8/29/2022 | |
5.3.0 | 2,616 | 7/31/2022 | |
5.2.0 | 1,699 | 7/24/2022 | |
5.1.0 | 2,984 | 7/3/2022 | |
5.0.2 | 2,690 | 5/27/2022 | |
5.0.1 | 1,601 | 5/23/2022 | |
5.0.0 | 1,383 | 5/23/2022 | |
4.5.0 | 1,347 | 5/22/2022 | |
4.4.0 | 3,247 | 4/3/2022 | |
4.3.0 | 1,514 | 3/27/2022 | |
4.2.1 | 1,674 | 3/16/2022 | |
4.2.0 | 1,423 | 3/14/2022 | |
4.1.0 | 1,669 | 3/9/2022 | |
4.0.1 | 1,447 | 3/8/2022 | |
4.0.0 | 1,480 | 3/7/2022 | |
3.7.1 | 2,666 | 12/15/2021 | |
3.7.0 | 2,666 | 11/20/2021 | |
3.5.0 | 1,182 | 11/12/2021 | |
3.4.1 | 1,568 | 11/8/2021 | |
3.4.0 | 1,312 | 11/8/2021 | |
3.2.0 | 1,545 | 10/17/2021 | |
3.1.4 | 1,072 | 10/14/2021 | |
3.1.2 | 2,299 | 8/13/2021 | |
3.1.1 | 1,044 | 8/11/2021 | |
3.1.0 | 1,868 | 3/22/2021 | |
3.1.0-pre | 270 | 3/22/2021 | |
3.0.0 | 979 | 10/29/2020 | |
3.0.0-pre | 830 | 10/29/2020 | |
2.0.2 | 1,214 | 8/12/2020 | |
2.0.1 | 1,209 | 7/27/2020 | |
2.0.0 | 1,134 | 7/27/2020 | |
1.0.0 | 1,155 | 7/27/2020 |