简体   繁体   English

在Tableview xamarin.forms中创建Listview

[英]Create Listview in Tableview xamarin.forms

I am not sure if I can add a list view inside the table section of the TableView . 我不确定是否可以在TableView的表部分中添加列表视图。 I tried to search online but can't seemed to find any solutions to this. 我试图在网上搜索,但似乎无法找到任何解决方案。 Am I missing out some tags? 我错过了一些标签吗? Would appreciate if someone would be able to help me out one this. 如果有人能帮我解决这个问题,我将不胜感激。

<TableView x:Name="tableView">
    <TableRoot>
        <TableSection x:Name="blockSection" Title="Name">
            <ListView x:Name="lvFilter">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <StackLayout Orientation="Horizontal">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="10">
                                            </ColumnDefinition>
                                            <ColumnDefinition Width="250">
                                            </ColumnDefinition>
                                            <ColumnDefinition Width="*">
                                            </ColumnDefinition>
                                            </Grid.ColumnDefinitions>
                                        <Label x:Name="filterName" Text="{Binding filterName}” YAlign="Center" Grid.Row="0" Grid.Column="1">
                                        </Label>
                                        <Image x:Name="ImageL" Source="check_mark.jpg" Grid.Row="0" Grid.Column="2">
                                        </Image>
                                    </Grid>
                                </StackLayout>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </TableSection>
    </TableRoot>
</TableView>

Just need to put the ListView inside a ViewCell. 只需要将ListView放在ViewCell中。

<TableSection>
    <ViewCell>
        <ListView>
            <ListView.Content>
                <StackLayout>
                    <Label Text="Testing123"/>
                </StackLayout>
            </ListView.Content>
    <ListView>
</ViewCell>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM