kritzelkratz
Topic Author
Posts: 18
Joined: 19 Sep 2013, 17:44

Problem with FontWeight="Bold"

04 Nov 2013, 16:27

Hi,
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?
 
User avatar
sfernandez
Site Admin
Posts: 1652
Joined: 22 Dec 2011, 19:20

Re: Problem with FontWeight="Bold"

04 Nov 2013, 16:38

Hi,

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:
Roboto-Regular.ttf
Roboto-Italic.ttf
Roboto-Bold.ttf
Roboto-BoldItalic.ttf
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:
<Grid>
    <Button Content="Click Me!" FontFamily="Fonts/#Roboto" />
    <Button Content="Click Me!" FontFamily="Fonts/#Roboto" FontWeight="Bold" />
</Grid>
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.
 
kritzelkratz
Topic Author
Posts: 18
Joined: 19 Sep 2013, 17:44

Re: Problem with FontWeight="Bold"

04 Nov 2013, 17:00

Thanks a lot!

Who is online

Users browsing this forum: No registered users and 1 guest