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?
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"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.