共用方式為


Text (album track) template (XAML)

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

Use this item template with a ListView to display a collection of media tracks.

This example shows the image gallery DataTemplate and a ListView that uses the template.

<DataTemplate x:Key="TextSongTemplate">          
    <StackPanel Orientation="Horizontal" Width="300"> 
        <TextBlock Text="#" FontSize="24" Margin="10,0,0,0" 
                   TextTrimming="WordEllipsis" TextWrapping="Wrap" 
                   HorizontalAlignment="Left"/>
        <TextBlock Text="Ay Lorem Ipsum" FontSize="24" Margin="10,0,0,0" 
                   TextTrimming="WordEllipsis" HorizontalAlignment="Left"/>                        
    </StackPanel>            
</DataTemplate>
<GridView x:Name="TextSongGrid" 
          VerticalAlignment="Stretch" HorizontalAlignment="Left" 
          CanReorderItems="True" CanDragItems="True" 
          ItemTemplate="{StaticResource TextSongTemplate}">                        
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <ItemsWrapGrid MaximumRowsOrColumns="13"/>                      
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
</GridView>

Note  This ListView uses a WrapGrid as its ItemsPanel to achieve a grid layout.