I using a separate project for my styles a and i have some line of codes like this in it:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Style x:Key="NazaninFont" TargetType="Control">
<Setter Property="FontFamily" Value="pack://application:,,,/Extra/Fonts/#IRNazanin"/>
</Style>
......
</ResourceDictionary>
My another styles (like control effects and...) work well when i use my style key in the element like this:
Style="{ms:MyStyleRef ResourceKey=MyStyleKey}"
But When i use the following code in my Lable element
<Label Style="{ms:MyStyleRef ResourceKey=NazaninFont}" x:Name="LabelRemainingSec" Content="{Binding RemainingSec}"/>
I have:
- In Design Time >> The
FontFamily
is set on IRNazanin on the properties panel but have not correct font view in the designer!
BUT
-
In Run Time >> The
FontFamily
is set on Tahoma (Window font)
Also i tested this way:
I added a style base on my font styles in the separate project, in top of my Window, like this:
<Style x:Key="NazaninFont" BasedOn="{ms:MyStyleRef ResourceKey=NazaninFont}" TargetType="Label"/>
Then i use it in my Lable normaly:
<Label Style="{StaticResource NazaninFont}" x:Name="LabelRemainingSec" Content="{Binding RemainingSec}"/>
Result is same as previous way:
In the Design Time
in the FontFamily
is on IRNazanin and have not correct font view in XAML designer! And in Run Time
it is on Tahoma
What do you think about my problem? I think think my styles can not give the font path to the Label
control correctly.