【发布时间】:2021-02-10 14:48:36
【问题描述】:
我正在制作一个移动应用程序,我正在尝试在列表视图中加载一个列表。该列表有多个元素和一个列表:
public static List<Proposition> PropositionList = new List<Proposition>
{
new Proposition{
PropositionId = Guid.Parse("00000000-0000-0000-0000-000000000001"),
Place= "Barge",
Date= new DateTime(2020, 7, 11),
Users= new List<User>(){
new User
{
UserId = Guid.Parse("00000000-0000-0000-0000-000000000001"),
Name= "Jan Aerts",
Sterren = 3
},
new User
{
UserId = Guid.Parse("00000000-0000-0000-0000-000000000002"),
Naam = "Bart Denys",
Sterren = 5
}
}
}
}
如何使用 x:Name="StacklayoutMap" 从我的 stacklayout 中的 Users.Name 制作一个列表
<ListView x:Name="lvPropositions" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Frame BorderColor="Black" Margin="10, 0, 10, 0" CornerRadius="45">
<StackLayout StyleClass="listitem" Padding="5">
<StackLayout Orientation="Horizontal">
<Label Style="{DynamicResource DivesLabelStyle}" Text="{Binding Datum}" VerticalOptions="Center" HorizontalOptions="StartAndExpand" />
<Label Style="{DynamicResource DivesLabelStyle}" Text="{Binding Plaats}" VerticalOptions="Center" HorizontalOptions="EndAndExpand" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<StackLayout x:Name="StackLayoutMap">
</StackLayout>
<ImageButton Source="addBlack.png" BackgroundColor="Transparent" HorizontalOptions="EndAndExpand" VerticalOptions="Center" Clicked="BtnRegister_Clicked"/>
</StackLayout>
</StackLayout>
</Frame>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
【问题讨论】:
标签: c# listview xamarin xamarin.forms