Skip to content

Commit

Permalink
(MahAppsGH-221) Add Pixelarticons v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Oct 2, 2020
1 parent 8495346 commit 6da67b1
Show file tree
Hide file tree
Showing 23 changed files with 1,239 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ This `IconPacks` library contains controls, markup extensions and converters to
| [Modern](http://modernuiicons.com/) | | 1260 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Modern/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Modern.svg?style=flat-square&&label=Modern"></a> |
| [GitHub Octicons](https://octicons.github.com/) | 9.6.0 | 204 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Octicons/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Octicons.svg?style=flat-square&&label=Octicons"></a> |
| [PICOL Icons](https://github.com/PicolSigns/Icons) | 1.1.0 | 549 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.PicolIcons/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.PicolIcons.svg?style=flat-square&&label=PicolIcons"></a> |
| [Pixelarticons](https://pixelarticons.com/) | 1.2.0 | 359 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.PixelartIcons/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.PixelartIcons.svg?style=flat-square&&label=PixelartIcons"></a> |
| [RPG Awesome](https://nagoshiashumari.github.io/Rpg-Awesome/) | 0.2.0 | 495 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.RPGAwesome/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.RPGAwesome.svg?style=flat-square&&label=RPGAwesome"></a> |
| [Simple Icons](https://simpleicons.org/) | 3.8.0 | 1405 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.SimpleIcons/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.SimpleIcons.svg?style=flat-square&&label=SimpleIcons"></a> |
| [Typicons](https://www.s-ings.com/typicons/) | 2.0.9 | 336 | <a href="https://www.nuget.org/packages/MahApps.Metro.IconPacks.Typicons/"><img src="https://img.shields.io/nuget/dt/MahApps.Metro.IconPacks.Typicons.svg?style=flat-square&&label=Typicons"></a> |
Expand Down
18 changes: 18 additions & 0 deletions src/MahApps.Metro.IconPacks.Browser/Styles/CustomTabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IconType}" Value="{x:Type iconPacks:PackIconPixelartIconsKind}">
<Setter TargetName="IconContent" Property="ContentTemplate">
<Setter.Value>
<DataTemplate DataType="{x:Type viewModels:IIconViewModel}">
<iconPacks:PackIconPixelartIcons Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}" Kind="{Binding Value, Mode=OneWay, Converter={converter:NullToUnsetValueConverter}}" SnapsToDevicePixels="True" BorderThickness="1" BorderBrush="{StaticResource SelectedIconBorderBrush}" Foreground="{DynamicResource MahApps.Brushes.AccentBase}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IconType}" Value="{x:Type iconPacks:PackIconRPGAwesomeKind}">
<Setter TargetName="IconContent" Property="ContentTemplate">
<Setter.Value>
Expand Down Expand Up @@ -454,6 +463,15 @@
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IconType}" Value="{x:Type iconPacks:PackIconPixelartIconsKind}">
<Setter TargetName="IconContent" Property="ContentTemplate">
<Setter.Value>
<DataTemplate DataType="{x:Type viewModels:IIconViewModel}">
<iconPacks:PackIconPixelartIcons Width="32" Height="32" HorizontalAlignment="Center" VerticalAlignment="Center" Kind="{Binding Value, Mode=OneWay}" />
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IconType}" Value="{x:Type iconPacks:PackIconRPGAwesomeKind}">
<Setter TargetName="IconContent" Property="ContentTemplate">
<Setter.Value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public MainViewModel(Dispatcher dispatcher)
new IconPackViewModel(this, "Modern", typeof(PackIconModernKind), typeof(PackIconModern)),
new IconPackViewModel(this, "Octicons", typeof(PackIconOcticonsKind), typeof(PackIconOcticons)),
new IconPackViewModel(this, "PICOL", typeof(PackIconPicolIconsKind), typeof(PackIconPicolIcons)),
new IconPackViewModel(this, "PixelartIcons", typeof(PackIconPixelartIconsKind), typeof(PackIconPixelartIcons)),
new IconPackViewModel(this, "RPGAwesome", typeof(PackIconRPGAwesomeKind), typeof(PackIconRPGAwesome)),
new IconPackViewModel(this, "SimpleIcons", typeof(PackIconSimpleIconsKind), typeof(PackIconSimpleIcons)),
new IconPackViewModel(this, "Typicons", typeof(PackIconTypiconsKind), typeof(PackIconTypicons)),
Expand All @@ -56,6 +57,7 @@ public MainViewModel(Dispatcher dispatcher)
typeof(PackIconModernKind),
typeof(PackIconOcticonsKind),
typeof(PackIconPicolIconsKind),
typeof(PackIconPixelartIconsKind),
typeof(PackIconRPGAwesomeKind),
typeof(PackIconSimpleIconsKind),
typeof(PackIconTypiconsKind),
Expand All @@ -79,6 +81,7 @@ public MainViewModel(Dispatcher dispatcher)
typeof(PackIconModern),
typeof(PackIconOcticons),
typeof(PackIconPicolIcons),
typeof(PackIconPixelartIcons),
typeof(PackIconRPGAwesome),
typeof(PackIconSimpleIcons),
typeof(PackIconTypicons),
Expand Down
14 changes: 14 additions & 0 deletions src/MahApps.Metro.IconPacks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.Oct
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.PicolIcons", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.PicolIcons.csproj", "{1487A11C-9C12-43A7-A7EA-C5234136CD07}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.PixelartIcons", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.PixelartIcons.csproj", "{79EB4876-621F-43BC-8B51-DAED7937CB4D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.RPGAwesome", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.RPGAwesome.csproj", "{AC7D3308-B470-4E51-9E91-44512031A557}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.IconPacks.SimpleIcons", "MahApps.Metro.IconPacks\MahApps.Metro.IconPacks.SimpleIcons.csproj", "{7EE30791-3F2A-4DD6-B0E4-2057E72C1FB9}"
Expand Down Expand Up @@ -342,6 +344,18 @@ Global
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x64.Build.0 = Release|Any CPU
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x86.ActiveCfg = Release|Any CPU
{EAEEF1E8-A3F0-4A5B-BB18-6F737858EC73}.Release|x86.Build.0 = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|x64.ActiveCfg = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|x64.Build.0 = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|x86.ActiveCfg = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Debug|x86.Build.0 = Debug|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|Any CPU.Build.0 = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|x64.ActiveCfg = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|x64.Build.0 = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|x86.ActiveCfg = Release|Any CPU
{79EB4876-621F-43BC-8B51-DAED7937CB4D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace MahApps.Metro.IconPacks.Converter
{
public class PackIconPixelartIconsKindToImageConverter : PackIconKindToImageConverterBase
{
/// <inheritdoc />
protected override string GetPathData(object iconKind)
{
string data = null;
if (iconKind is PackIconPixelartIconsKind PixelartIconsKind)
{
PackIconPixelartIconsDataFactory.DataIndex.Value?.TryGetValue(PixelartIconsKind, out data);
}
return data;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="MSBuild.Sdk.Extras">
<!-- Project properties -->
<PropertyGroup>
<DefineConstants>$(DefineConstants);PIXELARTICONS</DefineConstants>
<AssemblyName>MahApps.Metro.IconPacks.PixelartIcons</AssemblyName>
<Title>MahApps.Metro.IconPacks.PixelartIcons</Title>
<RootNamespace>MahApps.Metro.IconPacks</RootNamespace>
</PropertyGroup>
<!-- WPF Items include -->
<ItemGroup Condition="'$(_SdkShortFrameworkIdentifier)' != 'uap'">
<None Remove="**\*.rd.xml" />
<Compile Remove="*.cs;**\*Converter.cs" />
<Compile Include="**\PackIconPixelartIcons*.cs" Exclude="**\bin\**\*.*;**\obj\**\*.*" />
<Page Generator="MSBuild:Compile" Include="Themes\WPF\PixelartIcons\*.xaml" Link="Themes\%(RecursiveDir)%(Filename)%(Extension)" SubType="Designer" />
<Page Generator="MSBuild:Compile" Include="Themes\WPF\PackIconPixelartIcons.xaml" Link="Themes\%(RecursiveDir)%(Filename)%(Extension)" SubType="Designer" />
</ItemGroup>
<!-- UWP Items include -->
<ItemGroup Condition="'$(_SdkShortFrameworkIdentifier)' == 'uap'">
<Compile Remove="*.cs;**\*Converter.cs" />
<Compile Remove="Themes\UAP\**\*.*;Themes\WPF\**\*.*" />
<EmbeddedResource Include="**\$(AssemblyName).rd.xml" />
<Compile Condition=" '$(TargetFramework)' != 'uap10.0.16299' " Exclude="*Extension*.cs" Include="*PixelartIcons*.cs" />
<Compile Condition=" '$(TargetFramework)' == 'uap10.0.16299' " Exclude="*ImageExtension*.cs" Include="*PixelartIcons*.cs" />
<Page Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" Generator="MSBuild:Compile" Include="Themes\UAP\PixelartIcons\*.xaml;Themes\UAP\PackIconPixelartIcons.xaml" Link="Themes\%(RecursiveDir)%(Filename)%(Extension)" SubType="Designer" />
<Compile DependentUpon="%(Filename)" Update="**\*.xaml.cs" />
</ItemGroup>
</Project>
10 changes: 10 additions & 0 deletions src/MahApps.Metro.IconPacks/MahApps.Metro.IconPacks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ProjectReference Include="MahApps.Metro.IconPacks.Modern.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.Octicons.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.PicolIcons.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.PixelartIcons.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.RPGAwesome.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.SimpleIcons.csproj" />
<ProjectReference Include="MahApps.Metro.IconPacks.Typicons.csproj" />
Expand Down Expand Up @@ -192,6 +193,15 @@
<BuildOutputInPackage Include="$(OutDir)MahApps.Metro.IconPacks.PicolIcons\Themes\Generic.xaml">
<TargetPath>MahApps.Metro.IconPacks.PicolIcons\Themes\Generic.xaml</TargetPath>
</BuildOutputInPackage>
<BuildOutputInPackage Include="$(OutDir)MahApps.Metro.IconPacks.PixelartIcons\*.*">
<TargetPath>MahApps.Metro.IconPacks.PixelartIcons</TargetPath>
</BuildOutputInPackage>
<BuildOutputInPackage Include="$(OutDir)MahApps.Metro.IconPacks.PixelartIcons\Themes\PackIconPixelartIcons.xaml">
<TargetPath>MahApps.Metro.IconPacks.PixelartIcons\Themes\PackIconPixelartIcons.xaml</TargetPath>
</BuildOutputInPackage>
<BuildOutputInPackage Include="$(OutDir)MahApps.Metro.IconPacks.PixelartIcons\Themes\Generic.xaml">
<TargetPath>MahApps.Metro.IconPacks.PixelartIcons\Themes\Generic.xaml</TargetPath>
</BuildOutputInPackage>
<BuildOutputInPackage Include="$(OutDir)MahApps.Metro.IconPacks.RPGAwesome\*.*">
<TargetPath>MahApps.Metro.IconPacks.RPGAwesome</TargetPath>
</BuildOutputInPackage>
Expand Down
5 changes: 5 additions & 0 deletions src/MahApps.Metro.IconPacks/PackIconControlDataFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ internal static IDictionary<Enum, string> Create()
dictionary.Add(packIcon.Key, packIcon.Value);
}

foreach (var packIcon in PackIconPixelartIconsDataFactory.Create())
{
dictionary.Add(packIcon.Key, packIcon.Value);
}

foreach (var packIcon in PackIconRPGAwesomeDataFactory.Create())
{
dictionary.Add(packIcon.Key, packIcon.Value);
Expand Down
6 changes: 6 additions & 0 deletions src/MahApps.Metro.IconPacks/PackIconExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public override object ProvideValue(IServiceProvider serviceProvider)
return this.GetPackIcon<PackIconPicolIcons, PackIconPicolIconsKind>((PackIconPicolIconsKind) this.Kind);
}
#endif
#if ALL || PIXELARTICONS
if (this.Kind is PackIconPixelartIconsKind)
{
return this.GetPackIcon<PackIconPixelartIcons, PackIconPixelartIconsKind>((PackIconPixelartIconsKind) this.Kind);
}
#endif
#if ALL || RPGAWESOME
if (this.Kind is PackIconRPGAwesomeKind)
{
Expand Down
3 changes: 3 additions & 0 deletions src/MahApps.Metro.IconPacks/PackIconImageExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ protected override string GetPathData(object iconKind)
case PackIconPicolIconsKind picolIconsKind:
PackIconPicolIconsDataFactory.DataIndex.Value?.TryGetValue(picolIconsKind, out data);
return data;
case PackIconPixelartIconsKind pixelartIconsKind:
PackIconPixelartIconsDataFactory.DataIndex.Value?.TryGetValue(pixelartIconsKind, out data);
return data;
case PackIconRPGAwesomeKind rpgAwesomeKind:
PackIconRPGAwesomeDataFactory.DataIndex.Value?.TryGetValue(rpgAwesomeKind, out data);
return data;
Expand Down
75 changes: 75 additions & 0 deletions src/MahApps.Metro.IconPacks/PackIconPixelartIcons.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
#if (NETFX_CORE || WINDOWS_UWP)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#else
using System.Windows;
#endif

namespace MahApps.Metro.IconPacks
{
/// <summary>
/// PixelartIcons are licensed under the [MIT license](<see><cref>https://github.com/halfmage/pixelarticons/blob/master/LICENSE</cref></see>).
/// Contributions, corrections and requests can be made on GitHub <see><cref>https://github.com/halfmage/pixelarticons</cref></see>.
/// </summary>
public class PackIconPixelartIcons : PackIconControlBase
{
public static readonly DependencyProperty KindProperty
= DependencyProperty.Register(nameof(Kind), typeof(PackIconPixelartIconsKind), typeof(PackIconPixelartIcons), new PropertyMetadata(default(PackIconPixelartIconsKind), KindPropertyChangedCallback));

private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != e.OldValue)
{
((PackIconPixelartIcons)dependencyObject).UpdateData();
}
}

/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public PackIconPixelartIconsKind Kind
{
get { return (PackIconPixelartIconsKind)GetValue(KindProperty); }
set { SetValue(KindProperty, value); }
}

#if !(NETFX_CORE || WINDOWS_UWP)
static PackIconPixelartIcons()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIconPixelartIcons), new FrameworkPropertyMetadata(typeof(PackIconPixelartIcons)));
}
#endif

public PackIconPixelartIcons()
{
#if NETFX_CORE || WINDOWS_UWP
this.DefaultStyleKey = typeof(PackIconPixelartIcons);
#endif
}

protected override void SetKind<TKind>(TKind iconKind)
{
#if NETFX_CORE || WINDOWS_UWP
BindingOperations.SetBinding(this, PackIconPixelartIcons.KindProperty, new Binding() { Source = iconKind, Mode = BindingMode.OneTime });
#else
this.SetCurrentValue(KindProperty, iconKind);
#endif
}

protected override void UpdateData()
{
if (Kind != default(PackIconPixelartIconsKind))
{
string data = null;
PackIconPixelartIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data);
this.Data = data;
}
else
{
this.Data = null;
}
}
}
}
Loading

0 comments on commit 6da67b1

Please sign in to comment.