Xamarin 无效类型:所需类型为BindableProperty

Xamarin 无效类型:所需类型为BindableProperty,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我正在尝试使用以下代码基于平台设置填充 16,24,16,4 16,16,16,4 16,16,16,4 然而,我在OnPlatform上看到一个红色的波形,错误如下 Invalid type: expected type is BindableProperty, actual type is OnPlatform<Thickness> 无效类型:预期类型为BindableProperty,实际类型为OnPlatform 正确的配置方法是什么?这在我的系统上运行良好,也运行2

我正在尝试使用以下代码基于平台设置填充


16,24,16,4
16,16,16,4
16,16,16,4
然而,我在
OnPlatform
上看到一个红色的波形,错误如下

Invalid type: expected type is BindableProperty, actual type is OnPlatform<Thickness>
无效类型:预期类型为BindableProperty,实际类型为OnPlatform

正确的配置方法是什么?

这在我的系统上运行良好,也运行2.3.4。如果它在你的代码中不起作用,你需要显示更多的代码,也许在代码背后做一些奇怪的事情

    <ContentView.Padding>
    <OnPlatform x:TypeArguments="Thickness">
        <On Platform="iOS" Value="16,24,16,4"></On>
        <On Platform="Windows" Value="16,16,16,4"></On>
        <On Platform="Android" Value="16,16,16,4"></On>
    </OnPlatform>
</ContentView.Padding>

`
`

这对我很有效

这是配置此功能的正确方法之一。我看不出这个代码片段有任何错误。这可能是一个“假阳性”智能感知错误吗?你会看到红色的波形,但它有效吗?是的,你们都是对的!这是一个误报
`<ContentView>
    <ContentView.Padding>
      <OnPlatform x:TypeArguments="Thickness" 
                  Android="16,16,16,4" 
                  WinPhone="16,16,16,4"
                  iOS="16,24,16,4"/>
   </ContentView.Padding>
 <ContentView>`