charri / Font-Awesome-WPF

FontAwesome controls for WPF+UWP
MIT License
533 stars 145 forks source link

Added: markup extension #31

Open VolodymyrBaydalka opened 8 years ago

VolodymyrBaydalka commented 8 years ago

Markup extention to convert from FontAwesomeIcon to string without bindings. Useful for styles and document element such Run, etc.

Example:

<TextBlock>
  Info <Run Text="{fa:FontAwesome InfoCircle}" FontFamily="pack://application:,,,/FontAwesome.WPF;component/#FontAwesome"/>
</TextBlock>
drewnoakes commented 8 years ago

Why not also add:

FontFamily="{fa:FontFamily}"

It's a shame to see such little response from the owner of this repo.

charri commented 8 years ago

I'm always a bit weary on long strings floating around the place. Would it be worth creating a second markup extension just for setting the font?

charri commented 8 years ago

Well it helps to read stuff before posting! @drewnoakes had already posted what I was refering to :) - woops!

VolodymyrBaydalka commented 8 years ago

Reason for this markup extension was that I'm tired of searching for codes for icons. Especially when you need to work with run's

With font family there is no such a problem. You can define own style or static resource for it

<FontFamily x:Key="FontAwesomeFamily">pack://application:,,,/FontAwesome.WPF;component/#FontAwesome</FontFamily>
...
<TextBlock FontFamily="{StaticResource FontAwesomeFamily}"

I don't think that worth to create another markup extension. Maybe just define a shared static resource