我想在listview里面创建listview。我试着下面的代码,这是不工作在Android中,相同的代码在iOS中完美工作listview里面的listview Xamarin.Forms
<local:CustomListview
x:Name="ListView"
ItemsSource="{Binding List1}" HasUnevenRows="True"
>
<local:CustomListview.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout
Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Name}"></Label>
<Label Text="{Binding CreatedOn}"></Label>
</StackLayout>
<Label Text="{Binding Description}"></Label>
<StackLayout
Orientation="Horizontal"
>
<Label Text="{Binding Count}"></Label>
<Label Text="Likes(s)"></Label>
</StackLayout>
<StackLayout
Orientation="Vertical"
Padding="5, 0, 0, 0"
>
<local:CustomListview ItemsSource="{Binding List2}" HasUnevenRows="True">
<local:CustomListview.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical">
<Label Text="{Binding Description}"></Label>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding CreatedBy}"></Label>
<Label Text="{Binding CreatedOn}"></Label>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</local:CustomListview.ItemTemplate>
</local:CustomListview>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</local:CustomListview.ItemTemplate>
</local:CustomListview>
有什么建议吗?
我不能使用组列表视图,因为我需要以特殊方式安排像Label这样的控件。我绑定子列表视图作为父列表视图的ItemsSource的一部分。上面的代码不工作,它只显示父级列表视图,不显示子列表视图。
为什么它在Android上“不工作”?你可以再详细一点吗? – Demitrian