IconPack extensions at runtime

0
0

Hi guys,

Regarding the various IconPack extensions… I compiled their code, added the references, but I cannot see any of their contents in my code. I mean I cannot do something like
“using Wisej.Ext.FontAwesome;”

Is there any way to access the icon lists from code in better way than having to remember the icon name, e.g. intellisense-like:

PictureBox1.ImageSource = “resource.wx/” + Wisej.Ext.FontAwesome.arrowup.ToString();     // for an icon named “arrowup” in the FontAwesome pack

An enumeration would be great!  I could go and build up such an enumeration from the folder contents, but if you have it at hand and can expose it somehow, it would be better.

Best,
Alex

  • You must to post comments
0
0

The designer shows the icons and a preview in the file source editor.

In code you have to use the name and since they are all embedded resources there is no automatic enumeration. Also an enumeration or anything that compiles wouldn’t work with names with dashes “arrow-circle-down.svg”. You’d have to create a static class with static variables with the names.

public static class Resources
{
public const string ArrowCircleDown = “arrow-circle-down.svg”;

….
}

ModernUI has 1276 of them – maybe a tool or macro for VS would work.

 

  • You must to post comments
0
0

Hi Alex,

we will provide a set of const definitions for the Icon Libraries in the next build.

Best regards
Frank

  • You must to post comments
0
0

Hi guys,

I followed Luca’s suggestion for static string constants, so you can use the attached if you like.

Best,

Alex

Attachment
  • You must to post comments
0
0

Nice addition!

Frank wrote a tool to auto generate the class so now you can use it at runtime like this:

this.pictureBox1.ImageSource = Wisej.Ext.FontAwesome.Icons.Archive;

The const includes the full prefix.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.