Language: HTML | XAML

Text (album track) template (XAML)

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

Text grid for 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.

 

 

Show:
© 2015 Microsoft