我有一长串电影演员,但我不想显示所有演员,而只是说他们的前5名。我不想创建另一个列表。可以在xaml中限制ListView
的项目吗?
<ListView RelativePanel.Below="cast" RelativePanel.AlignLeftWith="cast" Height="auto" Margin="50,10, 0, 0" Width="auto"
ItemsSource="{x:Bind ViewModel.MovieFullDet.MovieCredits.Cast}" >
<ListView.ItemTemplate>
<DataTemplate>
<RelativePanel Margin="5, 5, 5, 5">
<TextBlock Name="name" Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock RelativePanel.Below="name" RelativePanel.AlignLeftWith="name" Text="{Binding Character}" Margin="0,5,0,0"/>
</RelativePanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="3" Orientation="Horizontal" ></ItemsWrapGrid>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>