C
C#6mo ago
malkav

Trying to add Fonts to a Style.xaml in WPF

I have a folder containing the fonts I wish to use in my application. namely; RnC-Demo.otf as well as the complete Roboto-*.ttf [black, blackitalic, bold, boldcondensed, boldcondenseditalic, bolditalic, condensed, condenseditalic, italic, light, lightitalic, medium, mediumitalic, regular, thin, thinitalic] Now I wanted to add these to my Styles/Root.xaml file in such a way that later in my application the default font for various items (like headers, base-text, buttons, etc) will be set by default, or I override them at the point of usage. However, with all the examples and documentations I found online, there seem to be so many variations, and none seem to work. I am aware that might be me and not the documentation... Here's what I'm trying now, but I'm not sure if this is right.
<FontFamily x:Key="CrystalTrack.Gui.Fonts.Family.RnC">RnC Demo Fonts,/CrystalTrack.Gui;component/Fonts/#RnC-Demo Fonts</FontFamily>
<FontFamily x:Key="CrystalTrack.Gui.Fonts.Family.Roboto">RnC Demo Fonts,/CrystalTrack.Gui;component/Fonts/#RnC-Demo Fonts</FontFamily>
<FontFamily x:Key="CrystalTrack.Gui.Fonts.Family.RnC">RnC Demo Fonts,/CrystalTrack.Gui;component/Fonts/#RnC-Demo Fonts</FontFamily>
<FontFamily x:Key="CrystalTrack.Gui.Fonts.Family.Roboto">RnC Demo Fonts,/CrystalTrack.Gui;component/Fonts/#RnC-Demo Fonts</FontFamily>
My file locations are as follows:
|-- Solution/
| |-- CrystalTrack.Gui/
| | |-- Fonts/
| | | |-- *.otf/*.ttf files
| | |-- Style/
| | | |-- Root.xaml
| | | |-- App.xaml
| |-- App.xaml
| |-- MainPage.xaml
|-- Solution/
| |-- CrystalTrack.Gui/
| | |-- Fonts/
| | | |-- *.otf/*.ttf files
| | |-- Style/
| | | |-- Root.xaml
| | | |-- App.xaml
| |-- App.xaml
| |-- MainPage.xaml
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server