Xamarin 表单:RowDefinition height OnIdiom 属性的正确格式是什么?

Sre*_*ree 1 grid rowdefinition xamarin.forms

我在网格内有 2 行,因为第一行具有固定大小。我正在尝试在这里应用该OnIdiom功能。尝试如下:

<Grid.RowDefinitions>
    <RowDefinition>
        <RowDefinition.Height>
            <OnIdiom x:TypeArguments="x:Double">
                <OnIdiom.Phone>30</OnIdiom.Phone>
                <OnIdiom.Tablet>60</OnIdiom.Tablet>
            </OnIdiom>
        </RowDefinition.Height>
    </RowDefinition>
    <RowDefinition Height="auto"/>
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)

但在错误列表中出现以下错误:

No property, bindable property, or event found for 'Height', or mismatching type between value and property.
Run Code Online (Sandbox Code Playgroud)

RowDefinition 高度 OnIdiom 属性的正确格式是什么?

msh*_*hwf 6

您可以使用OnIdiom标记扩展:

<RowDefinition Height="{OnIdiom Phone=30, Tablet=60}"/>
Run Code Online (Sandbox Code Playgroud)