C# OnPlatform标记在Xamarin表单中不起作用

C# OnPlatform标记在Xamarin表单中不起作用,c#,xaml,xamarin.forms,cross-platform,C#,Xaml,Xamarin.forms,Cross Platform,我使用的是XamarinStudio6.1,它最近升级为XamarinForms项目。我似乎无法让平台上的标签正常工作。我正在尝试这样的事情 <Grid Padding="12"> <Grid.HeightRequest> <OnPlatform /> </Grid.HeightRequest> </Grid> 预览程序立即中断并抱怨XAML:TypeOnPlatform在xmlns=”中找不到无效

我使用的是XamarinStudio6.1,它最近升级为XamarinForms项目。我似乎无法让平台上的标签正常工作。我正在尝试这样的事情

<Grid Padding="12">
    <Grid.HeightRequest>
        <OnPlatform />
    </Grid.HeightRequest>
</Grid>

预览程序立即中断并抱怨XAML:Type
OnPlatform在xmlns=”中找不到无效的XAML:Typehttp://xamarin.com/schemas/2014/forms“


我以前从未见过这个错误,在网上找不到任何帮助。有什么想法吗?

可能是因为没有指定
类型参数。试试这个:

<Grid.HeightRequest>
    <OnPlatform x:TypeArguments="x:Double"
      iOS="15" Android="10" WinPhone="10"/>
</Grid.HeightRequest>

更新:

上面的语法已弃用。新表格为:

<Grid.HeightRequest>
    <OnPlatform x:TypeArguments="x:Double">
        <On Platform="iOS" Value="15"/>
        <On Platform="Android" Value="10"/>
        <On Platform="WinPhone" Value="10"/>
    </OnPlatform>
</Grid.HeightRequest>


它现在显示
无效的XAML:Type Double在xmlns中找不到
x
Double
放置
x:Double
名称空间标识符,就像
x:Double
是的,对不起,我的错了。有时候我真是个笨蛋