C# 按钮重量不小于';行不通

C# 按钮重量不小于';行不通,c#,xaml,fonts,windows-phone-7.1,C#,Xaml,Fonts,Windows Phone 7.1,我尝试设置按钮的字体权重,但字体权重仍然相同 我的纽扣 <Button x:Name="MyButton" Grid.Row="3" FontWeight="Bold" Content="something" Padding="16,10,12,12" FontSize="24" Background="White" Foreground="#400000" HorizontalContentAlignment="Left"

我尝试设置按钮的字体权重,但字体权重仍然相同

我的纽扣

<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。
请参见下面我在代码中添加此属性并将其设置为“精简”的地方:

对于WP7.x,任何页面级别的样式都将显式覆盖您正在执行的操作,因此您需要做更多的工作:

    <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" />


您没有为按钮指定字体权重…什么??我在您的XAML.ohh中的任何地方都看不到
FontWeight
属性。很抱歉,我粘贴了错误的代码,它现在已编辑。它不起任何作用,在designer窗口中,我看到了更改,但当我在手机上运行它时,字体重量变小了unchanged@Earlgray对不起,我只测试了WP8。对于WP7.X(我应该已经发现您已经指定了它)来说是不同的。我已经更新了答案,并在VS designer和emulator中进行了测试。