.net Maui TableView标题是否大写?

oalqel3c  于 2022-12-14  发布在  .NET
关注(0)|答案(1)|浏览(110)

我正在尝试使用Maui的内置TableView,但是我不能使我的表视图的标题显示大写字母。有人知道如何解决这个问题吗?
我尝试使用Title=“Example Text”,但显然这不起作用,我将TableRoot和TableSection中的标题都显示为小写。
我已经编辑显示代码和图像的问题。
编辑:只有当试图在Windows上运行时,问题才不会在Android上出现。

<TableView Intent="Menu"
               HorizontalOptions="Center"
               >
        <TableRoot Title="Example Text"
                   >
            <TableSection>
                <TextCell Text="First Example"
                          Detail="Example details"/>
                <TextCell Text="Second Example"
                          Detail="Example details"/>
            </TableSection>
        </TableRoot>
    </TableView>

Resulting table

2nc8po8w

2nc8po8w1#

Yes, I can reproduce your issue. You could report an issue at Maui Issue
Additionally, as TableView is a descendant of ListView, it could be superseded by ListView or CollectionView. So, I recommend using ListView as an alternative. You could try using ListView.Header to define the Header. ListView also provides you a ItemSource and ItemTemplate which makes the control more customized. I wrote a small demo for you as an example:

<ListView>
    <ListView.Header>     
        <StackLayout BackgroundColor="LightGray">
            <Label Margin="10,0,0,0"
                   Text="Example Text"
                   FontSize="12"
                   FontAttributes="Bold" />
        </StackLayout>
    </ListView.Header>
    <ListView.ItemsSource>
        <x:Array Type="{x:Type x:String}">
            <x:String>First Example</x:String>
            <x:String>Second Example</x:String>
        </x:Array>
    </ListView.ItemsSource>
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Label Text="{Binding .}" />
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

For more info, you could refer to .NET MAUI ListView
Hope it works for you. If you still have questions, feel free to ask.

相关问题