0
你好我想用下面的代码应用自定义字体的标签Xamarin.forms自定义字体异常
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ExerClub.Pages.Profile" Title="Profile">
<StackLayout>
<Label Text="Login">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<OnPlatform.iOS>MarkerFelt-Thin</OnPlatform.iOS>
<OnPlatform.Android></OnPlatform.Android>
<OnPlatform.WinPhone></OnPlatform.WinPhone>
</OnPlatform>
</Label.FontFamily>
</Label>
<Label Text="Club Name"/>
<Label Text="More randomness"/>
</StackLayout>
</ContentPage>
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ExerClub.Pages
{
public partial class Profile : ContentPage
{
public Profile()
{
InitializeComponent();
}
}
}
这是从Xamarin.forms Documentation
采取的背后我在iOS上收到以下错误
System.ArgumentException: Object of type 'System.String' cannot be converted to type 'Xamarin.Forms.View'.
我是Xamarin新手,不太明白为什么这可能会失败。
能否请您显示完整的页面?除非我忽略了某些事情,否则错误似乎不是来自这里。 –
我在后面添加了代码。我没有真正改变任何东西,教程也没有提及任何东西。 – xerotolerant
您是否使用NuGet的最新版Xamarin.Forms?如果没有,更新和重建。 – therealjohn