Button FontWeight不起作用
本文关键字:不起作用 FontWeight Button | 更新日期: 2023-09-27 18:05:39
我尝试设置按钮的字体重量,但字体重量仍然相同。
我的按钮<Button x:Name="MyButton"
Grid.Row="3"
FontWeight="Bold"
Content="something"
Padding="16,10,12,12"
FontSize="24"
Background="White"
Foreground="#400000"
HorizontalContentAlignment="Left" />
我该如何解决这个问题?
要设置FontWeight
,你必须设置FontWeight。
下面我将这个属性添加到代码中,并将其设置为"Thin":
WP7。任何页面级别的样式都会覆盖你所做的,所以你需要做更多的工作:
<Button x:Name="MyButton"
Grid.Row="3"
Padding="16,10,12,12"
FontSize="24"
Background="White"
HorizontalContentAlignment="Left" >
<TextBlock Text="something"
Style="{StaticResource PhoneTextNormalStyle}"
Foreground="#400000"
FontWeight="Thin" />
</Button>
注意,我必须为内容设置样式,然后应用FontWeight,它将覆盖样式中的内容。
此(简单版本)将适用于WP8
<Button x:Name="MyButton"
FontWeight="Thin"
Grid.Row="3"
Content="something"
Padding="16,10,12,12"
FontSize="24"
Background="White"
Foreground="#400000"
HorizontalContentAlignment="Left" />