AlpacaMan
AlpacaMan

Reputation: 513

How to define columns for maui TableView?

This document describes how to use the TableView control. I notice that every example in this doc displays items in one column. Because TableView is a table, I guess it can display items in multiple columns. However I can't find the way to do it. Does anyone know how to do it?

Upvotes: 1

Views: 4367

Answers (1)

FreakyAli
FreakyAli

Reputation: 16572

There is an example in that document itself that uses a default ViewCell and creates two columns with Grid: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/tableview#view-cell

<TableView Intent="Settings">
    <TableRoot>
        <TableSection Title="Silent">
            <ViewCell>
                <Grid RowDefinitions="Auto,Auto"
                      ColumnDefinitions="0.5*,0.5*">
                    <Label Text="Vibrate"
                           Margin="10,10,0,0"/>
                    <Switch Grid.Column="1"
                            HorizontalOptions="End" />
                    <Slider Grid.Row="1"
                            Grid.ColumnSpan="2"
                            Margin="10"
                            Minimum="0"
                            Maximum="10"
                            Value="3" />
                </Grid>
            </ViewCell>
        </TableSection>
    </TableRoot>
</TableView>

Good luck

Upvotes: 1

Related Questions