How do I make WPF ListView items repeat horizontally, like a horizontal scrollbar? How do I make WPF ListView items repeat horizontally, like a horizontal scrollbar? wpf wpf

How do I make WPF ListView items repeat horizontally, like a horizontal scrollbar?


Set the ItemsPanel of the ListView to a horizontal StackPanel. Like this:

<ListView.ItemsPanel>    <ItemsPanelTemplate>        <StackPanel Orientation="Horizontal"></StackPanel>    </ItemsPanelTemplate></ListView.ItemsPanel>


Perhaps a better way to do this would be to use a VirtualizingStackPanel which has all of the same properties but is much more performant especially for listboxes with lots of items.


I found it easier to go this way

<ItemsControl ItemsSource="{Binding Path=Steps}"><ItemsControl.ItemTemplate>    <DataTemplate>        <TextBlock Text="{Binding PageName}" Padding="10" />    </DataTemplate></ItemsControl.ItemTemplate>    <ItemsControl.ItemsPanel>    <ItemsPanelTemplate>        <WrapPanel></WrapPanel>    </ItemsPanelTemplate></ItemsControl.ItemsPanel>