使用FontStretch的文本块继承FontStyle和Weight

时间:2012-11-27 12:18:59

标签: .net wpf xaml

我有一个WPF控件,其中包含许多用于设置字体粗细,样式,装饰和拉伸的切换按钮。在每个切换按钮中都有TextBlock,用于显示样式。

出于某种原因,我为Condensed FontStretch创建了切换按钮,在运行时出现在ExtraBold,Oblique和Concentsed中。同样,任何设置为Condensed的文本也会以这种方式出现。在desinger中按钮显示正确。

我想这可能是因为我将其他按钮设置为ExtraBold和Oblique的相同字体系列,并且字体将保存在缓存中。

<ToggleButton Height="24" HorizontalAlignment="Left" Margin="110,232,0,0" Name="boldButton" VerticalAlignment="Top" Width="36">
        <TextBlock Text="Abc" FontFamily="Arial" FontWeight="Bold"/>
    </ToggleButton>
    <ToggleButton Height="24" HorizontalAlignment="Left" Margin="152,232,0,0" Name="extraBoldButton" VerticalAlignment="Top" Width="36">
        <TextBlock Text="Abc" FontFamily="Arial" FontWeight="ExtraBold"/>
    </ToggleButton>
    <ToggleButton  Content="Abc"  FontFamily="Arial" FontStyle="Italic" Height="24" HorizontalAlignment="Left" Margin="110,261,0,0" Name="italicButton" VerticalAlignment="Top" Width="36" />
    <ToggleButton  Content="Abc"  FontFamily="Arial" FontStyle="Oblique" Height="24" HorizontalAlignment="Right" Margin="0,261,91,0" Name="obliqueButton" VerticalAlignment="Top" Width="36" />                  

                     

0 个答案:

没有答案