locked
How to store font family as a static resource RRS feed

  • Question

  • Hello,

    How to store font family as a static resource so that it can be used globally.

    Thanks in advance.

    Tuesday, March 4, 2014 7:24 AM

Answers

  • This works for me :

      <FontFamily x:Key="MyTheme">Cambria</FontFamily>

    Usage :

      <TextBlock Text="Hello" FontFamily="{StaticResource MyTheme}" FontSize="48"></TextBlock>

    Sagar

    • Marked as answer by zee_patel Tuesday, March 4, 2014 9:50 AM
    Tuesday, March 4, 2014 9:44 AM

All replies

  • See StaticResource mark-up extension for defining shared types in a resource dictionary and Style in the Xaml namespace for setting properties of types.
    Tuesday, March 4, 2014 9:17 AM
  • This works for me :

      <FontFamily x:Key="MyTheme">Cambria</FontFamily>

    Usage :

      <TextBlock Text="Hello" FontFamily="{StaticResource MyTheme}" FontSize="48"></TextBlock>

    Sagar

    • Marked as answer by zee_patel Tuesday, March 4, 2014 9:50 AM
    Tuesday, March 4, 2014 9:44 AM
  • Thanks Sagar.

    Actually VS is not showing FontFamily in Intellisense, I paste it in and it's works Fine!

    Tuesday, March 4, 2014 9:50 AM