forked from MahApps/MahApps.Metro.IconPacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MahAppsGH-221) Add Pixelarticons v1.2.0
- Loading branch information
Showing
23 changed files
with
1,239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/MahApps.Metro.IconPacks/Converter/PackIconPixelartIconsKindToImageConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/MahApps.Metro.IconPacks/MahApps.Metro.IconPacks.PixelartIcons.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.