共用方式為


Text list (media queue) 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 list of text items similar to the queue in a media app.

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

<DataTemplate x:Key="TextMediaQueueTemplate">          
    <StackPanel Orientation="Horizontal" Width="600" Height="50">                   
        <StackPanel Orientation="Vertical" VerticalAlignment="Top" Margin="0,10,0,0">
            <TextBlock Text="Ayllus Nec Ipsum Tempor Id Laoreet Vive" Margin="10,2,0,0" 
                       TextTrimming="WordEllipsis" TextWrapping="Wrap" 
                       HorizontalAlignment="Left"/>
            <TextBlock Text="Ay Lorem Ipsum" Opacity="0.49" 
                       FontSize="11" FontWeight="Semilight" 
                       Margin="10,0,0,0" Height="26" TextTrimming="WordEllipsis" 
                       HorizontalAlignment="Left" VerticalAlignment="Top"/>
            </StackPanel>
        <TextBlock Text="Ay proin leo mulla scelerisque mu" 
                   FontSize="11" Opacity="0.49" Margin="40,2,0,0" 
                   TextTrimming="WordEllipsis" TextWrapping="Wrap" 
                   VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
          <TextBlock Text="00:00" FontSize="11" Opacity="0.49" Margin="40,0,0,0" 
                   VerticalAlignment="Center"/>
    </StackPanel>            
</DataTemplate>
    <ListView x:Name="TextMediaQueueList" Width="600" 
              VerticalAlignment="Stretch" HorizontalAlignment="Left" 
              CanReorderItems="True" CanDragItems="True" 
              ItemTemplate="{StaticResource TextMediaQueueTemplate}"/>