I try to set fontWeight of an Button but font weight is still the same.
My button
<Button x:Name="MyButton"
Grid.Row="3"
FontWeight="Bold"
Content="something"
Padding="16,10,12,12"
FontSize="24"
Background="White"
Foreground="#400000"
HorizontalContentAlignment="Left" />
How can I solve this problem?
To set the FontWeight you have to actually set the FontWeight.
See below where I've added this property to your code and set it to "Thin":
For WP7.x any page level style will override what you're doing explicitly so you need to do a little bit more work:
<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>
Note that I've had to set a style for the content and then applied a FontWeight which will override what's in the style.
This (simpler version) will work for 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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With