charri / Font-Awesome-WPF

FontAwesome controls for WPF+UWP
MIT License
530 stars 147 forks source link

Image = FontAwesome Image? #20

Closed andrewcartwright1 closed 8 years ago

andrewcartwright1 commented 8 years ago

Hey, great work on this.

I have recently added this to my app and have removed quite a lot of images I designed myself in favor of this. I'm wanting to use this in collaboration with Material Menu, which can set an Image in the MenuButton Control ie:

<materialMenu:MenuButton Text="Settings" Image=""/>

I was wondering if there was a way in the xaml to have it use a fontAwesome image? Or would this have to be set in the code behind?

Many thanks.

punker76 commented 8 years ago

@andrewcartwright1 what is materialMenu:MenuButton? is it a 3rd party lib?

andrewcartwright1 commented 8 years ago

Yeah, https://github.com/beto-rodriguez/MaterialMenu

punker76 commented 8 years ago

@andrewcartwright1 after first fast look it seems the MaterialButton should be allow this...

andrewcartwright1 commented 8 years ago

I'm just wondering how to achieve it, Xaml is not my strongest area unfortunatly.

Currently I'm looking at this

<materialMenu:MenuButton Text="Settings" Image="{fa:ImageAwesome Icon=Cog}">

And seeing errors, I know this is probably the wrong way to do it. Still trying a variety of ways to achieve it.

punker76 commented 8 years ago

@andrewcartwright1 problem is that Image property is a ImageSource

charri commented 8 years ago

I guess the quickest way, would be to assign the Image in the codebehind. Another solution would be to create a simple converter to supply an ImageSource from a FontAwesome icon. In the example project there is an example on how to obtain an ImageSource (icon for Window).

On 23 Oct 2015 23:38, Jan Karger notifications@github.com wrote:@andrewcartwright1 problem is that Image property is a ImageSource

—Reply to this email directly or view it on GitHub.

andrewcartwright1 commented 8 years ago

Hmm okay, I'll take a look at that. I guess there is no easier way to do this in the xaml itself ^^.

Thank you