1

I embedded Google's Material Design icon font into my WPF project by adding it into project resources.

The font displayed correctly in Visual Studio designer but showed only tofus (something like ) while running.

What am I doing wrong?

Here's what in App.xaml code:

<Application.Resources>
    <FontFamily x:Key="MaterialIcon">/ExampleProject;component/Resources/#Material Icons</FontFamily>
</Application.Resources>

And here's how I declared the button:

<Button x:Name="ExampleButton" Content="&#xE0C3;" FontFamily="{DynamicResource MaterialIcon}"/>

Screenshot:

Screentshot of designer and program

Thanks!

Huy Nguyen
  • 2,025
  • 3
  • 25
  • 37
Todd J. York
  • 135
  • 2
  • 12

1 Answers1

0

Mmmmmmmm, try to see this post: How to include external font in WPF application without installing it.

I think that the Uri used for specify the font path is not correct. In this case, you get a different behavior between design-time and runtime.

Community
  • 1
  • 1
Igor Damiani
  • 1,897
  • 9
  • 12