Is there any support to use the FontAwesome icons in the menus?
It looks like it might be possible to use templates to do this. I am creating the menus and items with code and cannot find good information about how to approach this. Is there anyone with a working implementation of FontAwesome icons?
5 Answers, 1 is accepted
You can choose between one of the following two approaches in order to use "Fontawesome" icons in RadMenu:
- Apply fonts by using sprite image feature of the RadMenu
- OR apply FontAwesome class names to RadMenu items and then assign the chosen chars to the assigned classes:
For convenience, I am attaching a sample project demonstrating the first approach, so you can examine it on your side.
Thanks for the reply, I tried both approaches and eventually implemented the second one as it would be a simpler implementation for us. I still have a small issue to get it to set the correct color for the icons E.g 'text-primary' .
I have tried to do it in the standard way to add it to the css property E.g: CssClass="fa fa-shopping-bag text-primary" but it does not seem to work. I have added the font color to the style declaration as a workaround but do not have the ability to set the individual icons to different colors or to disabled state.
font: normal normal normal 14px/1 FontAwesome;
color: #158cba; /* this is the color for 'text-primary' */
Thanks again for the help!
Try to apply the color through the rmLeftImage built-in class:
color: red ;
Thanks again for your replies
Next issue would be to do the same for the RadTreeView icons.
I need to set the node image on each node with code, as I use different icons depending on the actual node type:
node.ImageUrl = "~/img/icons/treeicons/closed.gif";
node.ExpandedImageUrl = "~/img/icons/treeicons/open.gif";
What would be a good approach to achieve the same with FontAwesome?
My current workaround is to just add the icons to the node text. This seems to work OK but node editing has to be handled in a special way. Let me know if there is a better solution.
You should override the CSS content and font-family properties of the :before elements that render the treeview icons.
Here you are a Stackoverflow thread that addresses this topic—http://stackoverflow.com/questions/20782368/use-font-awesome-icon-as-css-content. And for the unicode characters you can refer to this sheet—http://astronautweb.co/snippet/font-awesome/.
Here you are a simple example that you can follow: