Reputation: 1296
I added custom font:
[assembly: ExportFont("Roboto-Regular.ttf", Alias ="Roboto")]
Also in App.xaml
:
<Style TargetType="Label">
<Setter Property="FontFamily" Value="Roboto"/>
</Style>
And also can add for Entry and etc... But it is possible with one line of code change the Default Font Family which is initialized when u create the project? If is possible how?
Upvotes: 1
Views: 662
Reputation: 838
You would need to create your controls for label,entry,picker,etc. with the default font family. I've created labelcontrol one for you
public class MyFontLabel : Label
{
public MyFontLabel()
{
Style = Application.Current.Resources["FontLabelStyle"] as Style;
}
}
style in app.xaml
<Style x:Key="FontLabelStyle" TargetType="Label">
<Setter Property="FontFamily" Value="Roboto"/>
</Style>
Use it throughout
<local:MyFontLabel Text="My Text"/>
Upvotes: 2