【发布时间】:2019-08-10 22:03:59
【问题描述】:
<ListView HasUnevenRows="True" x:Name="collectionView" HeightRequest="1000"
Margin="20">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout HeightRequest="50" Margin="10" WidthRequest="200">
<Label Text="{Binding Name}" FontSize="15" TextColor="Black"/>
<Label Text="{Binding Description}" FontSize="15" TextColor="Black"/>
<ListView HasUnevenRows="True" ItemsSource="{Binding appointments}" HeightRequest="1000" Margin="20,0,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout HeightRequest="100" Margin="10" WidthRequest="200">
<Label Text="{Binding Name}" FontSize="15" TextColor="Black"/>
<Label Text="{Binding Subject}" FontSize="15" TextColor="Black"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
protected override void OnAppearing()
{
try
{
base.OnAppearing();
var appointemntsList = new List<Appointment>()
{
new Appointment() { Name="Mohamed",Subject="Sub"},
new Appointment() { Name="Mohamed",Subject="Sub"},
new Appointment() { Name="Mohamed",Subject="Sub"},
new Appointment() { Name="Mohamed",Subject="Sub"},
};
var Monkeys = new List<Appointment>()
{
new Appointment() { Name="Ahmed", Description="Desc",appointments=appointemntsList},
new Appointment() { Name="Ahmed", Description="Desc",appointments=appointemntsList},
new Appointment() { Name="Ahmed", Description="Desc",appointments=appointemntsList},
new Appointment() { Name="Ahmed", Description="Desc",appointments=appointemntsList},
};
collectionView.ItemsSource = Monkeys;
}
catch (Exception)
{
}
}
使用此代码我需要在列表视图中显示列表视图但不起作用
【问题讨论】:
-
什么不起作用?
-
在另一个可滚动控件中使用可滚动控件是一种不好的做法
-
您在寻找某种分组方式吗?
-
@DennisSchröer 在 ListView 中显示 ListView 第一个 ListView 显示良好,但第二个未显示
-
@G.hakim 如果我想在 ListView 中显示列表视图该怎么办
标签: xamarin xamarin.forms