XAML ListView项目限制

时间:2019-03-28 15:28:21

标签: xaml listview

我有一长串电影演员,但我不想显示所有演员,而只是说他们的前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>

0 个答案:

没有答案