Page 1 of 1

Problem with FontWeight="Bold"

Posted: 04 Nov 2013, 16:27
by kritzelkratz
In our xaml-File we're trying to create a bold, colored Label like this:
<Label FontWeight="Bold" Foreground="red">Hello</Label>
The Label's color is red, it doesn't appear to be bold, however. We've tried this with other FontWeights and TextBlock, both of which don't work, either.
What are we doing wrong here?

Re: Problem with FontWeight="Bold"

Posted: 04 Nov 2013, 16:38
by sfernandez

Font styles usually come from different .ttf files. If you are using your own font, you should provide the .ttf for all styles you want to use.

You can find an example in the first tutorial of the documentation.

A font resource (.font) is a text file with a list of file font references, one item per line. For example, Roboto.font contains:
Referenced .ttf files must be found next to the .font file. The .font file can contain as many references as you wish, even a single one, but it is recommended that all the referenced files belongs to the same font family, being that family the name of the .font file.

The above .font could be used this way:
    <Button Content="Click Me!" FontFamily="Fonts/#Roboto" />
    <Button Content="Click Me!" FontFamily="Fonts/#Roboto" FontWeight="Bold" />
Note that the reference to the font is relative to the location of the .xaml file. Here we are supposing that Roboto.font is located in the subfolder Fonts/ relative to the .xaml.

Referenced fonts must always be inside the project folder. Operating system fonts are not supported.

Re: Problem with FontWeight="Bold"

Posted: 04 Nov 2013, 17:00
by kritzelkratz
Thanks a lot!