Xamarin.Forms 中的 TableView 应该是灰色的吗?

Is my TableView in Xamarin.Forms supposed to be gray?

小问题:
Xamarin.Forms 中的 TableView 应该像下图一样全是灰色的吗?我期待的布局与我得到的类似,但各个 TableSections 的背景为白色。

这是因为iOS14,我做错了什么或者模拟器?我也遇到缺乏 DatePicker 和 TimePicker 支持的问题 - 在 android 上工作但在 iPhone 模拟器上不工作,我被告知这个问题是模拟器。

我没能在真实设备上测试它。 我在下面发布我的 Tableview XAML 代码。

XAML代码

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
    Title="{Binding FullName}"
    xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ContactBook.ContactsDetailPage">


    <TableView Intent="Form">
        <TableRoot>
            <TableSection Title="Personal Info">
                <EntryCell Label="First Name" Text="{Binding FirstName}" Keyboard="Text" />
                <EntryCell Label ="Last Name" Text="{Binding LastName}" Keyboard="Text"/>
            </TableSection>

            <TableSection Title="Contact Info">
                <EntryCell Label="Phone" Text="{Binding Phone}" Keyboard="Telephone"/>
                <EntryCell Label="Email" Text="{Binding Email}" Keyboard="Email" />

            </TableSection>

            <TableSection Title="Other">
                <SwitchCell Text="Blocked" On="{Binding IsBlocked}" />
            </TableSection>

            <TableSection>
                <ViewCell>
                    <Button Text="Save" HorizontalOptions="FillAndExpand" Clicked="Button_Clicked"/>
                </ViewCell>

            </TableSection>
        </TableRoot>

    </TableView>


</ContentPage>

TableView 有一个 BackgroundColor 属性 可以让你设置你想要的背景颜色。所以如果你想让它与你页面的其余部分相匹配,你可以这样做

<TableView Intent="Form" BackgroundColor="White">

您可以使用 ViewCellStackLayout 来实现,因为 xxxCell 不包含 BackgroundColor 属性。

例如代码如下:

        <TableSection Title="Contact Info">
            <ViewCell>
                    <StackLayout Orientation="Horizontal" BackgroundColor="White">
                        <Label Margin="10,0,0,0" Text="Phone" VerticalOptions="Center"/>
                        <Entry Text="Binding Phone" HorizontalOptions="FillAndExpand" Keyboard="Telephone"/>
                    </StackLayout>
            </ViewCell>
            <ViewCell>
                <StackLayout Orientation="Horizontal" BackgroundColor="White">
                    <Label Margin="10,0,0,0" Text="Email" VerticalOptions="Center" />
                    <Entry Text="Binding Email" HorizontalOptions="FillAndExpand" Keyboard="Email" />
                </StackLayout>
            </ViewCell>
        </TableSection>

        <TableSection Title="Other" >
            <ViewCell>
                <StackLayout Orientation="Horizontal" BackgroundColor="White">
                    <Label Margin="15,0,0,0" Text="Blocked" VerticalOptions="Center"/>
                    <Switch Margin="280,0,0,0" />
                </StackLayout>
            </ViewCell>
        </TableSection>

        <TableSection>
            <ViewCell>
                <StackLayout BackgroundColor="White">
                    <Button Text="Save"
                            HorizontalOptions="FillAndExpand"
                                />
                </StackLayout>
            </ViewCell>

        </TableSection>
    </TableRoot>

</TableView>

效果: