locked
Styling a font size or font family RRS feed

  • Question

  • Hi Experts,

     

    Is it possible to make a style for font size or font family like what we do for those common controls ?

     

    <Label Name="label1" Style="{DynamicResource NormalLabelStyle}

     

    where font size can be like..

    <Label Name="label1" FontSize="{DynamicResource FontSize}

     

    My purpose of doing cos i want to store a few font sizes in my configuration file.

    Hope to hear from you soon.. Thanks.

     

     

    Saturday, May 10, 2008 3:53 PM

Answers

  • I am not sure if you can create a style that you can set against FontSize, but you can create a style and set Font related values in it

     

    Code Snippet

            <Style x:Key="fontRes">

                <Setter Property="Control.FontSize" Value="9" />

                <Setter Property="Control.FontWeight" Value="Bold" />

                <Setter Property="Control.FontFamily" Value="Arial" />

            </Style>

     

     

     

    No TargetType is set in this Style, and so it can be applied to any control
    Sunday, May 11, 2008 5:44 AM