Reputation:
I am using listview to display images and text. Now i need to make it scrollable. I need to display the listview horizontal with scrollable. Thanks for the help
<Grid x:Name="Playlist" Visibility="{Binding IsShow}" Height="540" Width="960">
<ListView Name="listview" ItemsSource="{Binding Path=YourCollection}" IsItemClickEnabled="True" ItemClick="ListView_ItemClick" Margin="0,279,0,0">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="5" MaxHeight="150">
<Image Source="{Binding Image}" Height="144" Width="256"/>
<TextBlock Text="{Binding Title}" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
Upvotes: 2
Views: 165
Reputation: 1307
On the ListView set the attached ScrollViewer.HorizontalScrollBarVisibility property to Auto (show scrollbar if needed) or Visible (scrollbar is always visible).
Example:
<ListView ScrollViewer.HorizontalScrollBarVisibility="Auto" />
Upvotes: 1