Home > database >  Maui TableView Title capitalisation?
Maui TableView Title capitalisation?

Time:12-13

I am trying to use the built in TableView using Maui but I cannot make the title of my table view display capital letters. Does anyone have any idea how to solve this?

I tried using Title="Example Text" but obviously this has not worked and I have put the title both in TableRoot and TableSection both display lower case.

I have edited to show code and image of problem.

Edit: The problem does not occur on android only when trying to run on windows.

<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

CodePudding user response:

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.

  • Related