Material.Icons.WinUI3 2.1.10

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

// Install Material.Icons.WinUI3 as a Cake Tool
#tool nuget:?package=Material.Icons.WinUI3&version=2.1.10                

Material.Icons

Parsed icons set from materialdesignicons.com and display control implementations for different GUI frameworks.

  • All icons are always up-to-date because automatically updated every 6 hours.
  • Small package size because icons are graphically encoded via SVG Path.
  • Icon types are strongly typed enum, so your IDE will suggest available variants:
    895428ad-6010-4ffd-bd88-61aecd50f5e1

Structure

This project consists of 3 parts:

  • alternate text is missing from this package README image contains info about the icons

  • alternate text is missing from this package README image contains controls for AvaloniaUI

  • alternate text is missing from this package README image contains controls for WPF

  • FAQ - frequently asked questions

Community maintained

  • alternate text is missing from this package README image contains controls for WinUI/UNO (separate repository)

Avalonia

Getting started
  1. Install Material.Icons.Avalonia nuget package:
    dotnet add package Material.Icons.Avalonia
    
    avalonia-nuget avalonia-nuget
  2. Include styles in App.xaml (for 2.0.0 version and higher):
    <Application xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" 
                 ...>
      <Application.Styles>
        ...
        <materialIcons:MaterialIconStyles />
      </Application.Styles>
    </Application>
    
Using

Add Material.Icons.Avalonia namespace to the root element of your file (your IDE can suggest it or do it automatically):

xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"

Use MaterialIcon control:

<materialIcons:MaterialIcon Kind="Abacus" />

The Foreground property controls the color of the icon.
Also, there is MaterialIconExt which allows you to use is as the markup extension:

<Button Content="{materialIcons:MaterialIconExt Kind=Abacus}" />

Avalonia FuncUI (F#)

Getting started
  1. Install Material.Icons.Avalonia nuget package:
    dotnet add package Material.Icons.Avalonia
    
    avalonia-nuget avalonia-nuget
  2. Import styles in Application (or if you use XAML check instructions for plain Avalonia)
    type App() =
        inherit Application()
    
        override this.Initialize() =
            ..
            this.Styles.Add(MaterialIconStyles(null))
            ..
    
  3. Create bindings for MaterialIcon
    namespace Avalonia.FuncUI.DSL
    
    [<AutoOpen>]
    module MaterialIcon =
        open Material.Icons
        open Material.Icons.Avalonia
        open Avalonia.FuncUI.Types
        open Avalonia.FuncUI.Builder
    
        let create (attrs: IAttr<MaterialIcon> list): IView<MaterialIcon> =
            ViewBuilder.Create<MaterialIcon>(attrs)
    
        type MaterialIcon with
    
            static member kind<'t when 't :> MaterialIcon>(value: MaterialIconKind) : IAttr<'t> =
                AttrBuilder<'t>.CreateProperty<MaterialIconKind>(MaterialIcon.KindProperty, value, ValueNone)
    
  4. Use
    Button.create [
         Button.content (
             MaterialIcon.create [
                 MaterialIcon.kind MaterialIconKind.Export
            ]
        )
    ]
    

WPF

Getting started

Install Material.Icons.WPF nuget package:

dotnet add package Material.Icons.WPF

wpf-nuget wpf-nuget

Using

Add Material.Icons.WPF namespace to the root element of your file (your IDE can suggest it or do it automatically):

xmlns:materialIcons="clr-namespace:Material.Icons.WPF;assembly=Material.Icons.WPF"

Use MaterialIcon control:

<materialIcons:MaterialIcon Kind="Abacus" />

The Foreground property controls the color of the icon.
Also, there is MaterialIconExt which allows you to use is as the markup extension:

<Button Content="{materialIcons:MaterialIconExt Kind=Abacus}" />

Meta

Getting started

Install Material.Icons nuget package:

dotnet add package Material.Icons

icons-nuget icons-nuget

Using

Icon types stored in Material.Icons.MaterialIconKind enum.
We can resolve an icon path by using Material.Icons.MaterialIconDataProvider.GetData().

Adding your own icons

Currently, there is no way to add your own icons, as icons are enum and cannot be modified.
But you can override some existing icons to use your own data:

public class CustomIconProvider : MaterialIconDataProvider
{
    public override string ProvideData(MaterialIconKind kind)
    {
        return kind switch
        {
            MaterialIconKind.TrophyVariant => "some SVG code",
            _ => base.ProvideData(kind)
        };
    }
}

// When your application starts (e.g. in the Main method) replace MaterialIconDataProvider with your own
public static int Main(string[] args)
{
    MaterialIconDataProvider.Instance = new CustomIconProvider(); // Settings custom provider

    // Application startup code
    // return BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}

FAQ

How to change icon color?
  • Change Foreground property.
How to change size?
  • If you are using MaterialIcon control - use Width or/and Height properties.
  • If you are using MaterialIconExt - use Size property.
How to update icons?
  • You can manually set Material.Icons package version in your project file.
What about versioning policy?
  • We use semver.
    Any package with identical major and minor versions is compatible.
    For example, 1.0.0 and 1.0.1 are compatible, but 1.0.0 and 1.1.0 might not be.
Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.18362 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.10 86 9/7/2024

- Icons set updated according to materialdesignicons.com at Thu, 20 Jun 2024 12:18:52 GMT
     Check out changes at https://pictogrammers.com/library/mdi/history/